Originally Posted by
VernonDozier
Write a function that does not allow for negative input:
int GetNonNegativeInteger ()
{
int input;
cin >> input;
while (input < 0)
{
// display error message.
// ask for input again
}
return input;
}
Call this function from main when you need non-negative integer input.
Now I am confused.
Last edited by davids2004; Nov 18th, 2008 at 12:28 am.