4-if语句

#include  
using namespace std;  
  
int main(){  
      
    //if语句   
    int score = 0;  
    cout << "请输入一个分数:" << endl;  
    cin >> score;  
    cout << "您输入的分数为:" << score << endl;  
      
    if (score >= 90 && score <= 100) {  
        cout << "A" << endl;   
    }   
    else if (score >= 80 && score < 90) {  
        cout << "B" << endl;  
    }      
    else if (score >= 70 && score < 80) {  
        cout << "C" << endl;  
    }  
    else if (score >= 60 && score < 70) {  
        cout << "D" << endl;   
    }  
    else {  
        cout << "E" << endl;  
    }  
      
    return 0;  
}
//else if 后面可以加条件
//else 后面不能加条件
//C++ 不支持链式比较运算 如if(0

你可能感兴趣的:(C++,c++)