题解 | 判断成绩等级
#include <iostream> using namespace std; int main() { int score; cin >> score; // write your code here...... if (score < 0 || score > 100) { cout << "成绩不合法" << endl; } else { cout << (score < 60 ? "差" : (score < 70 ? "及格" : (score < 80 ? "中" : (score < 90 ? "良" : "优秀")))) << endl; } return 0; }