#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
float score;
int a;
char p;
while(true)
{
cout << "please input a score:";
cin >>score;
if (score >= 90)a = 0;
else if (score >= 80)a = 1;
else if (score >= 70)a = 2;
else if (score >= 60)a = 3;
else a = 4;
switch(a)
{
case 0:p = ‘A‘; break;
case 1:p = ‘B‘; break;
case 2:p = ‘C‘; break;
case 3:p = ‘D‘; break;
case 4:p = ‘E‘; break;
}
cout << p<<endl;
}
}
运行结果如下:
原文地址:https://www.cnblogs.com/rorelys/p/9734743.html
时间: 2024-10-14 08:32:31