qfedu-basic-level/day7/d5.cpp

48 lines
687 B
C++

// 测试switch分支
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cout << "输入您的成绩:" << endl;
cin >> n;
switch (n)
{
case 100:
cout << "你是最优秀的 ";
case 99:
case 98:
case 97:
case 96:
case 95:
case 94:
case 93:
case 92:
case 91:
case 90:
cout << "A";
break;
case 89:
case 88:
case 87:
case 86:
case 85:
case 84:
case 83:
case 82:
case 81:
case 80:
cout << "B";
break;
default:
cout << "D";
break;
}
cout << endl;
return 0;
}