1913: 成绩评估 Time Limit: 1 Sec Memory Limit: 64 MB
Submit: 327 Solved: 149
[ Submit][ Status][ Web Board]
Description
我们知道,高中会考是按等级来的。 90~100为A; 80~89为B; 70~79 为C; 60~69为D; 0~59为E。 编写一个程序,对输入的一个百分制的成绩t,将其转换成对应的等级。
Input
输入数据有多组,每组占一行,由一个整数组成。
Output
对于每组输入数据,输出一行。如果输入数据不在0~100范围内,请输出一行:“Score is error!”。
Sample Input
56 67 100 123
Sample Output
E D A Score is error!
#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
if(n>=0&&n<=100)
{if(n>=90)
cout<<'A'<<endl;
else if(n>=80)
cout<<'B'<<endl;
else if(n>=70)
cout<<'C'<<endl;
else if(n>=60)
cout<<'D'<<endl;
else
cout<<'E'<<endl;}
else cout<<"Score is error!"<<endl;}
return 0;
}