题解 | #判断成绩等级#
判断成绩等级
https://www.nowcoder.com/practice/1a12e246764243ada9043699b9a1e7ef
#include <iostream> using namespace std; int main() { int score; cin >> score; // write your code here...... if (score < 0 || score > 100) cout << "成绩不合法" << endl; else { switch (score / 10) { case 10: case 9: cout << "优秀" << endl; break; case 8: cout << "良" << endl; break; case 7: cout << "中" << endl; break; case 6: cout << "及格" << endl; break; default: cout << "差" << endl; } } return 0; }