c++ - Code with No Errors, Undesired Result -
when run code, user not prompted input desire. text box opens can typed in, after typing in.. name.. , pressing enter, nothing happens. issue having user receives no prompts later inserted 'story' @ bottom of code.
#include <iostream> #include <string> using namespace std; int main() { //list of variables stored string name; string city; int age; string college; string job; string animal; string petname; //user prompts answered user input cin >> name; cin >> city; cin >> age; cin >> college; cin >> job; cin >> animal; cin >> petname; //the output story include user input part of final result cout << "there once person named " + name + " lived in " + city + "." "at age of " << endl; cout << age + ", " + name + " went college @ " + college + "." + name + " graduated , went work" << endl; cout << " " + job + ". then," + name + " adopted a(n)" + animal + " named " + petname + ". they" << endl; cout << "both lived happily ever after!"; }
//user prompts answered user input cout << "enter name:"; cin >> name; cout << "enter city:"; cin >> city; cout << "enter age:"; cin >> age;
Comments
Post a Comment