#include<iostream>
using namespace std;
int main()
{
int t;
while (cin >> t)
{
if (t > 100 || t<0)
cout << "Score is error!" << endl;
if (t<=100 && t>=90)
cout << "A"<< endl;
if (t<90 && t>=80)
cout << "B"<< endl;
if (t<80 && t>=70)
cout << "C" << endl;
if (t<70 && t>=60)
cout << "D" << endl;
if (t>=0 && t<60)
cout << "E" << endl;
}
return 0;
}
大于100和小于0要输入Score is error!,这个要注意,刚开始想用break简洁代码,发现不能持续输入。还是要用逻辑运算符。
2004 成绩转换
最新推荐文章于 2021-02-27 22:41:05 发布