题解 | #判断成绩等级#
判断成绩等级
https://www.nowcoder.com/practice/1a12e246764243ada9043699b9a1e7ef
#include <iostream> using namespace std; void Grade(int score) { if (score >= 90 && score <= 100) { cout << "优秀"; } else if (score >= 80 && score < 90) { cout << "良"; } else if (score >= 70 && score < 80) { cout << "中"; } else if (score >= 60 && score < 70) { cout << "及格"; } else if (score >= 0 && score < 60) { cout << "差"; } else { cout << "成绩不合法"; } } int main() { int score; cin >> score; Grade(score); return 0; }