simple c++ problem
hey everyone...ya know how if you do a bunch of cins in a row how the enter from the previous one can be held and used in the next one? i know thats kinda vague, but thats the only way i can say it..anyway, how do you clear the buffer or whatever so input statements after the cins dont get screwed up?? suggestions?
i don''t know what you''re talking about but look up "flush"
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
After a cin use the ignore member function that is a part of cin. Like if you only need the user to enter a single number or char or something, you would say cin >> character; cin.ignore(). That would dump every thing else the user typed in, like if they typed in 2 chars. It would delete that 2nd one and keep the 1st one of course. If you want the user to enter in no more than say 10 chars then you would do this. cin >> characters; cin.ignore( 10, ''\n'' ); If that is not what you need, try using cin >> flush. I think thats how you do it.
-Snyper
-Snyper
=============================Where's the 'any' key?=============================
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement