In chapter 10 (input and output streams) of "Programming principle and practice using C++" in the part that manage bad input, i've found this function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int get_int(int low, int high)
{
cout<<"Please enter an integer in the range "
<<low<<" to "<<high<<" (inclusive:\n";
while (true)
{
int n = get_int();
if (low<=n && n<=high) return n;
cout<<"Sorry "
<<n<<" is not in the ["<<low<<':'<<high
<<"] range; please try again\n";
}
}
After this the book says:
"This get_int() is as stubborn as the other. It keeps getting ints from the non-range get_int() until the int it gets is in the expected range."
Now where is cin in this code?
i mean i can't see any command that allows the user to input something