B
B. Fletcher
Hi
I'm currently converting a console Java application into C++, and I am
having a problem. I am a newbie at C++ and any help would be apreaciated.
My code says;
int marbles;
....
cin >> marbles;
If I type a word into the program, the program goes into an infinite loop. I
know this is because I'm using the >> version of cin, but the alternatives
dont allow for:
If the user doesn't enter an int, I want the program to display a promt to
the user. But if there is an error/EOF while reading, I want a different
prompt displayed.
Btw, I am using MingW g++.exe to compile. the version of MingW I am using
came with Borland C++ BuilderX.
Does anyone have any suggestions on the method I can use?
Any help would be greatly appreaciated.
B.
I'm currently converting a console Java application into C++, and I am
having a problem. I am a newbie at C++ and any help would be apreaciated.
My code says;
int marbles;
....
cin >> marbles;
If I type a word into the program, the program goes into an infinite loop. I
know this is because I'm using the >> version of cin, but the alternatives
dont allow for:
If the user doesn't enter an int, I want the program to display a promt to
the user. But if there is an error/EOF while reading, I want a different
prompt displayed.
Btw, I am using MingW g++.exe to compile. the version of MingW I am using
came with Borland C++ BuilderX.
Does anyone have any suggestions on the method I can use?
Any help would be greatly appreaciated.
B.