Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pknz

macrumors 68020
Original poster
Mar 22, 2005
2,478
1
NZ
C++ Programming

How do you exit a while loop with an 'x'?
So far I have this
while(cin.good() && iCode!='x')

but if I run this and enter x, it is rejected by the fact it is not numerical
while (!cin.good() || iCode>999).

Also after a cout, how do you clear the line, I believe it is clreol(); but where do you put this to clear the line.

Thanks
 

SamMiller0

macrumors member
Aug 17, 2004
66
0
San Jose, CA
pknz said:
while(cin.good() && iCode!='x')

What type of variable is iCode?

I am not sure how to "clear the line" since that's platform specific. You can do it easily with a curses library, typically ncurses on Linux. As far as the mac, I am not sure. Someone will response hopefully.
 

pknz

macrumors 68020
Original poster
Mar 22, 2005
2,478
1
NZ
Thanks for yor help guys.

The tutorial was quite informative.

Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.