您的位置:首页 > 其它

2004 成绩转换

2016-07-27 13:16 302 查看
#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简洁代码,发现不能持续输入。还是要用逻辑运算符。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: