Hi,
just doing a simple progamme for my younger brother(a funny news spread).The programme asks for his name,favourite simpsons character and the like but halve way thru the code it starts out putting 2 questions without waiting for input from the user.Cant see what im doin wrong,
Code:#include<iostream> #include<string> using namespace std; int main() { string yourName; cout<<"please enter your name "<<endl; getline(cin,yourName); cout<<"thanks "<<yourName<<",would u mind answering afew questions?"<<endl; string yourGF; cout<<"What is your girlfriends name?"<<endl; getline(cin,yourGF); int favNumber=0; cout<<"what is your favourite number?"<<endl; cin>> favNumber; string Party; cout<<"what famous peson would u like at your party?"<<endl; getline(cin,Party); string hatedPet; cout<<"what is the pet animal you hate the most?"<<endl; getline(cin,hatedPet); string simpsons; cout<<"who is your favourite Simpsons character?"<<endl; getline(cin,simpsons); string favJob; cout<<"Nearly finished just a few more questions"<<endl; cout<<"What would you most like to do for a living?"<<endl; getline(cin,favJob); cin.get(); return 0; }
I put in cin.get() at the end so hat the console window doesnt shut
Again any help much appreciated.
Labmouse