/* Using logical operators to validate input */ #include using namespace std; int main() { int grade; cout << "Enter a numerical grade, and I will tell you" << endl; cout << "how well the student performed: "; cin >> grade; // read an integer if (grade >= 0 && grade <= 100) { cout << "The student received a letter grade of "; if (grade >= 90 ) cout << "A"; else if (grade >= 80) cout << "B"; else if (grade >= 70) cout << "C"; else if (grade >= 60) cout << "D"; else cout << "F"; cout << "." << endl; } else cout << "The grade must be between 0 and 100." << endl; return 0; }