Must output an Error Message if any of the input is inappropriate

Hello;

I need help trying to figure out how to output an error message if any of my input is inappropriate.
If any of the entries is >100, then it should display "Error: Data out of range". But it has to be done in the same way the "Error: Inproper numeric format" message appears, in case letters are inputed instead of numbers.

My program looks like this:

int main (void)
{
cout << "Enter three test scores in the range [0..100], " << endl;
cout << "separated by spaces: ";
int A, B, C;
cin >> A >> B >> C;
cin.ignore(99,'\n');
if (!cin)

{
cin.clear();
cin.ignore (99,'\n');

cout << endl;
cout << "Error: Improper numeric format. Press Enter to terminate program...";
cin.ignore(99,'\n');
return 1;

}


// Process


if ((A>=50 && A<=100) && (B>=50 && B<=100) && (C>=50 && C<=100))
cout << "Grade: Pass " << endl;

else if (((A >50 && B>50) || (B>50 && C>50) ||(A>50 && C>50))
&& (A>=40 && B>=40 && C>=40) && (((A+B+C)/3)>=50))
cout << "Grade: Pass by Compensation " << endl;

else if ((A<50 || B<50 || C<50) || (((A+B+C)/3)<50))
cout << "Grade: Fail " << endl;


cout << endl;
cout << "Press ENTER to finish...";
cin.ignore(99,'\n');
return 0;
}

Thank you for your time.
So what's the problem? Add if(A > 100 || B > 100 || C > 100){ cout << "error"; /*...*/ } before // Process
Thank you :)
Topic archived. No new replies allowed.