首页 > 代码库 > 成绩转换

成绩转换

 

#include<iostream>
using namespace std;

int main()
{
    int N; //测试数据组数
    cin>>N;

    while(N--)
    {
        int M;  //百分制成绩
        cin>>M;

        int a=M/10;

        switch(a)
        {
        case 9:
        case 10:
            cout<<"A"<<endl;break;
        case 8:
            cout<<"B"<<endl;break;
        case 7:
            cout<<"C"<<endl;break;
        case 6:
            cout<<"D"<<endl;break;
        case 5:
        case 4:
        case 3:
        case 2:
        case 1:
        case 0:
            cout<<"E"<<endl;break;
        default:
            cout<<"error"<<endl;
        }
    }
    return 0;
}