i need assistance. please wat i need i my code if for when a number greater than 99 and less than 0 is inputted. it shhould give an error. and let me reenter the number again, same for the second and third number value. please assist. cheers
int value_1, value_2, value_3, average;
cout << " Enter three separate integers in the range of 0 to 99 \n\n";
thanks i had done that, sorry i dint include this. what am actually looking for when a numebr lesser than 0 and greater than 99, it should output an error message till the correct value is entered for the three numbers. please would be very greatful if my code could be edited.. thanks
int _tmain(int argc, _TCHAR* argv[])
{
cout <<"\nweclome to c++\n";
cout <<"Enter three values in the range of 0 to 99.";
You can loop and if the value is OK break the loop otherwise show the error message and continue looping
eg:
1 2 3 4 5 6 7 8 9
int n;
while (true) // infinite loop
{
cout << "Value? ";
cin >> n;
if ( n<99 && n>0 ) //input is OK
break; // exit from the loop
cout << "Invalid input!\n";
}