只返回第一个if语句?(C++)

Nao*_*son 0 c++ if-statement switch-statement

这是我正在进行的任务:

编写一个程序,提示用户输入课程所获得的分数并确定分数.该程序应显示成绩的成绩和消息字符串.使用'if else'语句确定要打印消息字符串的等级和switch语句.

我编写了代码并且执行时没有任何调试错误.问题是,无论我输入什么作为我PointsEarned,我只得到F的输出!例如,如果我输入"90":

Try Harder Next Time.
GRADE: F
Run Code Online (Sandbox Code Playgroud)

有什么问题?我把我的switch语句放在错误的地方吗?这是代码:

#include <iostream>
using namespace std;
int main()
{
    int PointsEarned;
    char Grade;
    cout << "Please input the points earned in the course: ";
    cin >> PointsEarned;
    if (0 <= PointsEarned < 60) {
        Grade = 'F';
    }
    else if (60 <= PointsEarned < 70) {
        Grade = 'D';
    }
    else if (70 <= PointsEarned < 80) {
        Grade = 'C';
    }
    else if (80 <= PointsEarned < 90) {
        Grade = 'B';
    }
    else if (90 <= PointsEarned) {
        Grade = 'A';
    }
    else{
        cout << "That is not a  valid input.";
    }
    switch (Grade)
    {
    case 'F':
    case 'D':
        cout << "Try Harder Next Time." << endl;
        break;
    case 'C':
        cout << "Good." << endl;
        break;
    case 'B':
        cout << "Very good." << endl;
        break;
    case 'A':
        cout << "Excellent." << endl;
        break;
    default:
        cout << "Please choose a valid input to receive your grade." << endl;
    }
    cout << "GRADE: " << Grade << endl;
}
Run Code Online (Sandbox Code Playgroud)

Bin*_*gsF 5

0 <= PointsEarned < 60使用Python而不是C++ 比较表单的工作原理.你应该用0 <= PointsEarned && PointsEarned < 60.