Jump to content
  • Advertisement

Archived

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

way_out_west

Simple Question about cin.get();

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

Just so I fully understand... when cin.get() requests a character (or string) from the inpput buffer and the buffer is empty, it waits for new input and only then does it continue its execution.

Share this post


Link to post
Share on other sites
Advertisement
i only recently learned about cin.get cause im finnaly gettin on track to programming...but.....ive been taught to either add a cin.ignore(9999,''\n''); then a cin.get(); or two cin.get();s because the buffer is not empty usually...the last enter keypress should still be there...so its safer to add 2 or the ignore....thats probably not even two vcents....but it might help

Share this post


Link to post
Share on other sites
Yeah cin.get() doesn''t read in the newline character so that will be left and picked up by your next cin call.

You can use (cin.get()).get() since cin.get() returns a cin object.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!