PDA

View Full Version : c++ problem: waiting for user input [renamed]


wo1olf
02-27-2007, 10:13 AM
here's the code...

if(op ==a)
cout << question;
getline(cin,answer)
traiteInfo(answer);

i'm tryin to put the informations entered by the user in the variable answer. I use getline because i have to take the whole information (especially it is a sentence). The problem i'm havin is as soon as the question is shown, the program doesn't wait for the user, it just continue runnin.
anyone know how solve it

Ben H
02-27-2007, 10:44 AM
2 things:

1. You don't have a semicolon after the getline function.
2. You don't need to use getline, even for your purposes. cin will suffice:

cin>>answer;

-Ben

Janna122003
03-09-2007, 03:53 AM
You should post the whole code to better analyze your question.