hdu 2004 成绩转换

成绩转换

 

 思路:提前设好数组char a[] = "EEEEEEDCBAA";计算成绩%10,看看是什么成绩

代码:

#include<iostream>
using namespace std;
int main()
{
    char a[] = "EEEEEEDCBAA";
    int num;
    while (cin >> num)
    {
        if (num > 100||num<0)
        {
            cout << "Score is error!" << endl;
        }
        else{
            cout << a[num/10] << endl;
        }
        }

    system("pause");
    return 0;
}

 

posted @ 2020-02-01 21:30  PCDL&TIPO  阅读(195)  评论(0编辑  收藏  举报