fork(1) download
  1. // Nicolas Ruano
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. string name, city, college, profession, animal, petName;
  8. int age;
  9.  
  10. // Gather user input
  11. cout << "Enter your name: Nicolas\n";
  12. getline(cin, name);
  13.  
  14. cout << "Enter your age: 20\n";
  15. cin >> age;
  16. cin.ignore();
  17.  
  18. cout << "Enter the name of a city: Dana Point\n";
  19. getline(cin, city);
  20.  
  21. cout << "Enter the name of a college: Saddleback\n";
  22. getline(cin, college);
  23.  
  24. cout << "Enter a profession: Concept Designer\n";
  25. getline(cin, profession);
  26.  
  27. cout << "Enter a type of animal: Dog\n";
  28. getline(cin, animal);
  29.  
  30. cout << "Enter a pet's name: Rocky\n";
  31. getline(cin, petName);
  32.  
  33. // Build the story
  34. cout << "\nHere is your story:\n\n";
  35. cout << "There once was a person named Nicolas" << name << " who lived in " << city << "Dana Point.\n";
  36. cout << "At the age of " << age << "20, " << name << "went to college at " << college << "Saddleback.\n";
  37. cout << name << " graduated and went to work as a" << profession << "Concept Designer.\n";
  38. cout << "Then, " << name << "adopted a(n) dog" << animal << " named " << petName << "Rocky.\n";
  39. cout << "They both lived happily ever after!\n";
  40.  
  41. return 0;
  42. }
  43.  
  44.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Enter your name: Nicolas
Enter your age: 20
Enter the name of a city: Dana Point
Enter the name of a college: Saddleback
Enter a profession: Concept Designer
Enter a type of animal: Dog
Enter a pet's name: Rocky

Here is your story:

There once was a person named Nicolas who lived in Dana Point.
At the age of 172616042920, went to college at Saddleback.
 graduated and went to work as aConcept Designer.
Then, adopted a(n) dog named Rocky.
They both lived happily ever after!