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