How to create paragraphs in c++?

Viewed 81

I'm creating a madlib game via C++, and would like the output to be in paragraphs. I would like to create indented lines for the first line of paragraphs, and words that don't cut off. I know there are tutorials on this, but I am very new this, (only writing c++ for a week) and can't seem to find one that applies to my code. Any tips in the right direction or help would be appreciated.

using namespace std;
int main() {
  
  string 
  color, 
  emotion, 
  pluralNoun,
  pronoun,
  number,
  adjective,
  medicine,
  adjectivetwo,
  bodypart,
  room;

  cout << "enter a color: ";
  getline (cin, color) ;
  cout << "enter an emotion : ";
  getline (cin, emotion) ;
  cout << "enter a plural noun: " ;
  getline (cin, pluralNoun) ;
  cout << "enter a pronoun: ";
  getline (cin, pronoun) ;
  cout << "enter a number: " ;
  getline (cin, number) ;
  cout << "enter an adjective: " ;
  getline (cin, adjective) ;
  cout << "enter a type of medicine: " ;
  getline (cin, medicine) ;
  cout << "enter another adjective: " ;
  getline (cin, adjectivetwo) ;
  cout << "enter a room in your house: " ;
  getline (cin, room) ;
  cout << "enter any body part besides hands: ";
  getline (cin, bodypart) ;
  

string measuringStick(80, '-'); 
cout << measuringStick << endl;

  
  cout << "When I looked down, I noticed my hands were " << color << "." << endl;
  cout << "In that moment I felt so " << emotion << "." << endl;
  cout << "There must be more to life than " << pluralNoun << " and the color " << color << "." << endl;
  cout << "How many days will I go without " << pronoun << "?" << endl;
  cout << "I've counted about " << number << " days so far and I believe this is having an effect on my body." << endl;
  cout << "That is why my hands are so " << color << " and " << adjective << "." << endl;
  cout << "But you know I went to the doctor and they told me all I needed was some " << medicine << "." << endl;
  cout << "The advil did nothing but make me feel " << adjectivetwo << "." << endl;
  cout << "I do nothing but sit in my " << room << "." << endl;
  cout << "I wonder how much longer until the " << color << " spreads to my " << bodypart << " as well.";

string measuringSticktwo (80, '-'); 
cout << measuringSticktwo << endl;
  
  return 0;
}


0 Answers
Related