Top.Mail.Ru
The C++ Community's Journal -- Day
? ?
The C++ Community's Journal -- Day [entries|friends|calendar]
The C++ Community

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

Greetings and salutations! [09 Feb 2003|11:24pm]
Hi all,
I'm new to c++ and computer programming in general, so if I'm asking stupid questions, bear with me.

I'm trying to write a program that asks the user a yes/no question, and store that y or n into a char variable. As I understand it, this works great if the user types in only one letter, but if they type the whole word, or a phrase like "yes, please", all that extra data will be stored in a buffer, and used every time there is another cin call. I'm trying to figure out how to clear out that buffer so I can then ask for more input, or in some other way prevent that extra data from entering the buffer in the first place.
I was told to use cin.get, but that doesn't sem to solve the problem.
4 comments|post comment

navigation
[ viewing | February 9th, 2003 ]
[ go | previous day|next day ]
Image