Jump to content
  • Advertisement

Archived

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

slightlywhacked

funky output

This topic is 6442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!