How do i get C++ to output an error code using if statement?
I created a code to determine the letter grade by inputting a numeric value. However, i am trying to test grades above 100 and below 0. I wrote an OR condition and still not getting a output of my error.. The code is below: int main() { int grade = 0; cout <<"Enter a numeric grade: "; cin >> grade; if (grade >=90 && grade <=100) cout << "Letter grade is A"; else if (grade >=80) cout << "Letter grade is B"; else if (grade >=70) cout << "Letter grade is C"; else if (grade >=60) cout <<"Letter grade is D"; else cout <<"Letter grade is F"; if (grade < 0 || grade > 100) cout << "Error: Invalid numeric value"; } output: Enter a numeric grade: 456 Letter grade is BError: Invalid numeric value