//Kevin Thomas CS1A Chapter 3, P. 148, #22
/**************************************************************
*
* Play Word Game
* ____________________________________________________________
* This program will collect data from the user and use it to play a word game.
* ____________________________________________________________
* INPUT
* name: Represents the user's name
* age: Represents the user's age
* city: Represents a city name entered by the user
* college: Represents a college name entered by the user
* job: Represents a profession entered by the user
* animal: Represents a type of animal entered by the user
* petName: Represents the name of a pet entered by the user
* story:
* OUTPUT
* The story made by combining the user's information with the story provided by the problem.
*
**************************************************************/
#include <iostream>
using namespace std;
int main() {
//Declare variables
string name;
string age;
string city;
string college;
string job;
string animal;
string petName;
string response;
//Ask the user for each piece of information, then store it in the respective variable.
cout << "Enter your name: " << endl;
cin >> name;
cout << "Enter your age: " << endl;
cin >> age;
cout << "Enter a city name: " << endl;
cin >> city;
cout << "Did you go to college? (Y/N)" << endl;
cin >> response;
if (response == "Y") {
cout << "Enter a college name: " << endl;
cin >> college;
}
cout << "Enter a job title: " << endl;
cin >> job;
cout << "Enter a type of animal: " << endl;
cin >> animal;
cout << "Enter a pet name: " << endl;
cin >> petName;
//Output the resulting paragraph
if (response == "Y"){
cout << "There once was a person named " << name << " who lived in " << city << ". At the age of " << endl;
cout << age << " , " << name << " went to college at " << college << ". " << name << " graduated and went to work" << endl;
cout << "as a " << job << ". Then, " << name << " adopted an " << animal << " named " << petName << ". They" << endl;
cout << "both lived hapily ever after!";
}
else
{
cout << "There once was a person named " << name << " who lived in " << city << ". At the age of " << endl;
cout << age << " , " << name << ". " << name << " graduated and went to work" << endl;
cout << "as a " << job << ". Then, " << name << " adopted an " << animal << " named " << petName << ". They" << endl;
cout << "both lived hapily ever after!";
}
return 0;
}