I'm trying to validate user input for integers only. My code works fine except when the user inputs 0. It doesn't consider it an integer, and it thinks the value is false. Here's a brief example of how I'm coding this project....
int main ()
{
int num;
cout << "Please enter an integer: ";
cin >> num;
cout << endl;
while (! num)
{
cout << "That is not an integer.\n";
return;
}
}
If the user inputs 0, I get sent into the while loop even though 0 is an integer.