In the following very simple program, if the input is not an integer (e.g. a character symbol), then the output screen would flash and go away. Is there a way to have the output "bad" when one enters a non-integer, just as when one enters a negative number?
Thanks in advance!
int main()
{
int x;
cout << "enter integer: ";
cin >> x;
if (x>0)
cout << "good";
else
cout << "bad";
return 0;
}