What isthe correct syntax to handle a character or a keystoke that is not a number.
Posted on 2004-10-15
I am currently learning this languge, and I have a function that I would like to expand.
radius = -1;
while (radius <= 0)
cout << "Please enter the radius of the circle: ";
cin >> radius;
// Error checking
if (radius <= 0)
cout << endl << "Radius must be a number greater than zero."
cout << endl;
this takes care the possibility of the user entering a 0 or a - number as input. This was what I was required to do for an assignment. however, I was wondering how to, or the correct syntax to handle (error check) a character or a keystoke that is not a number.? Thanks much ,Annie