fork download
  1. //Cecilia Rangel CSC5 Chapter 3, P. 148, #22
  2. //
  3. /**************************************************************
  4.  *
  5.  * Compute a word game
  6.  * ____________________________________________________________
  7.  * This program computes a story based on the users input
  8.  *
  9.  *
  10.  *___________________________________________________________
  11.  * INPUT
  12.  * name : user's name
  13.  * age : user's age
  14.  * city : user's city
  15.  * college : user's college
  16.  * profesion : user's profesion
  17.  * animal : user's animal
  18.  * petName : user's pet's name
  19.  * OUTPUT
  20.  * Story: from users input
  21.  *
  22.  **************************************************************/
  23. #include <iostream>
  24. #include <iomanip>
  25. #include <string>
  26. using namespace std;
  27.  
  28. int main() {
  29. string name;
  30. string age;
  31. string city;
  32. string college;
  33. string profession;
  34. string animal;
  35. string petName;
  36.  
  37.  
  38. cout << "Enter your name\n";
  39. cin >> name;
  40. cout << "Enter your age\n";
  41. cin >> age;
  42. cout << "Enter the name of your city\n";
  43. cin >> city;
  44. cout << "Enter the name of your college\n";
  45. cin >> college;
  46. cout << "Enter your profession or what you want to work as\n";
  47. cin >> profession;
  48. cout << "Enter the type of pet you own\n";
  49. cin >> animal;
  50. cout << "Enter our pet's name\n";
  51. cin >> petName;
  52.  
  53.  
  54. cout << "There once was a person named " << name;
  55. cout << " who lived in " << city << ". At the age of\n";
  56. cout << age << ", " << name << " went to college at ";
  57. cout << college << ". " << name << " graduated and went";
  58. cout << " to work\nas a " << profession << ". Then, ";
  59. cout << name << " adopted a(n) " << animal << " named ";
  60. cout << petName << ". They\nboth lived happily ever after!";
  61. return 0;
  62. }
Success #stdin #stdout 0.01s 5288KB
stdin
Allen
18
Riverside
Rcc
Mechanical Engineer 
Dog
Hank
stdout
Enter your name
Enter your age
Enter the name of your city
Enter the name of your college
Enter your profession or what you want to work as
Enter the type of pet you own
Enter our pet's name
There once was a person named Allen who lived in Riverside. At the age of
18, Allen went to college at Rcc. Allen graduated and went to work
as a Mechanical. Then, Allen adopted a(n) Engineer named Dog. They
both lived happily ever after!