Archived

This topic is now archived and is closed to further replies.

slightlywhacked

funky output

Recommended Posts

hye.. im doin this porgram and it uses the peace of code.... if ( 1 < num_options) { cout << "Please enter option 1"; cin.get (option1, 50); cin.ignore (80, ''\n''); } if ( 2 < num_options) { cout << "Please enter option 2"; cin.get (option2, 50); cin.ignore (80, ''\n''); } if ( 3 < num_options) { cout << "Please enter option 3"; cin.get (option3, 50); cin.ignore (80, ''\n''); } when it runs i get : Please Enter Option 1 Please Enter Option 2 the it waits for input.. but it wont let me input option one... grrrr...whats wrong? and yes the if statment executes it HELP ARGGGGHHHHHH

Share this post


Link to post
Share on other sites
I think you need to flush stdin, like:

cin.flush();

Put that statement before your block of code, and see if it works!
Certain cin-functions gives you the input but leaves the terminating ''enter''-character in the buffer, so that the next time you try to get input from cin, you get that single enter-character...

//Ksero

Share this post


Link to post
Share on other sites