R
Roman Gavrilov
Have following snippet:
int i1, i2;
cin >> i1;
cin >> i2;
cout << i1 << ", " << i2;
If on first prompt I enter non-numeric value, then second value is not
prompted and i1, i2 are set to some weird value.
Q: is there something I can do to be able to enter second value even
if first value was invalid?
Note: cin.clear() - does not help.
Note: cin.clear() does help under Windows (WinXP), but does not work
under SunOS (5.2)
Thank you,
Regards,
Roman
int i1, i2;
cin >> i1;
cin >> i2;
cout << i1 << ", " << i2;
If on first prompt I enter non-numeric value, then second value is not
prompted and i1, i2 are set to some weird value.
Q: is there something I can do to be able to enter second value even
if first value was invalid?
Note: cin.clear() - does not help.
Note: cin.clear() does help under Windows (WinXP), but does not work
under SunOS (5.2)
Thank you,
Regards,
Roman