#include using namespace std; int main() { int score; while (cin >> score) { if (score < 0) { cout << "end" << endl; break; } if (score > 100) { cout << "data error!" << endl; continue; } if (score >= 90) cout << "A" << endl; else if (score >= 80) cout << "B" << endl; else if (score >= 70) cout << "C" << endl; else if (score >= 60) cout << "D" << endl; else cout << "E" << endl; } return 0;

编写一个学生成绩转换程序用户输入百分制的学生成绩:90~100时输出为A80~89时输出为B70~79时输出为C60~69时输出为D0~59时输出为E。输入数据超过100时输出data error!。用户可反复输入成绩进行转换输入负数时输出end并结束程序。输入格式每次输入一个整数代表百分制成绩;反复输入输入负数结束程序输出格式根据每一次的输入值分别输出A、B、C、D、E中的一个字母或data e

原文地址: https://www.cveoy.top/t/topic/hm4j 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录