Sign in to follow this  

cin.ignore ?

This topic is 4817 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

Quick question: when trying to ignore all charicters aside from the first entered in ex: cin >> "y or n"; user enters "yhuo...." I just want the y and I need everything else "flushed" What is happening is: cin >> "y or n"; user enters "yhuo...." cin >> "h or r"; 'h' from the last entry is being stored and used for this question. By adding this line after a cin >> choice; cin.ignore(256,' '); All inputs are ignored until a whitespace is entered (cplusplus.com) tutorial How can I apply this concept to this circumstance?

Share this post


Link to post
Share on other sites

This topic is 4817 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this