Relative to Inputing Answers to a Question

When enetering in the code for a question I have found my self entering in a question that requires more than 4 or 5 characters, I need more characters so that the program will not all of a sudden ask two questions at once. My program looks like this: Please any help is well appreciated, though my question is very minor, it would indeed help and improve my self-esteem.

/******************************************************************************

This program says hello at the screen to the user.
***************************************************************************/
#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;

int main()
{ //Scope opender for functin main

string color, fruit, Popstar, food, siblings, vacation, occupation;
string salary, car;
char name[30];



cout<<"Great now let me know a short biography about you\n";

//Send a prompt for input user's name.
cout<<"Enter your name:";
cin.getline(name, 30);


//Get favorite color.
cout << "Enter your favorite color: ";
cin >> color;


//Get user's favorite fruit.
cout << "Enter your favorite fruit: ";
cin >> fruit;

//Get user's favorite Popstar.
cout << "Enter your favorite Popstar, even if they may be a washed up" <<endl;
cout <<"celebrity: \n";
cin >> Popstar;

//Get user's favorite food.
cout << "Enter your favorite food:";
cin >> food;

//Get user's siblings count.
cout << "Enter the number of siblings you have in" <<endl;
cout <<"your family: \n";
cin >> siblings;

//Get user's vacation destination.
cout << "Enter your favorite vacation destination: \n";
cin >> vacation;

//Get user's occupation.
cout << "When you graduate college, what type of career would you" << endl;
cout <<"ensue: \n";
cin >> occupation;

//Get user's salary.
cout << "Enter your ideal starting salary: \n";
cin >> salary;

//Get user's favorite car.

cout << "Enter your favorite dream car, even if it may be a little" << endl;
cout <<"far fetched: \n";
cin >> car;

//Say hello to the individual using the program.
cout << "Hello, everyone! My name is "<< name <<" I am a student" << endl;
cout << "enrolled at Springfield College." <<endl;

cout << "My favorite color is "<< color <<" and my favorite fruit " << endl;
cout << "is "<< fruit <<". I really enjoy watching my favorite Popstar "<< Popstar <<endl;
cout << "while eating "<< food << " and " << fruit <<"." ;

cout << "I have "<<siblings<< " siblings, I would really like to vacation" << endl;
cout << "in "<< vacation <<". My goal is to graduate and become a "<<occupation<<".";

cout << "My ideal starting salary is "<< salary <<". One of the" <<endl;
cout << "first things that I want to do once I start working is to burn" <<endl;
cout << "a hole in my pocket by buying a" << color << "(make your friends jealous)" << car <<"." <<endl;

cout << "I hope that you have enjoyed learning about me!\n";

cout <<name<< endl;







system("PAUSE");
return 0;
}
Last edited on
And how does this help me
If you don't want an answer to your question then don't ask.

Here's a hint:
1
2
string name;
getline( cin, name );
It helps you by reading someone else code to see how it was done :)
Topic archived. No new replies allowed.