p3_2.cpp
来自「相当丰富的C++源码」· C++ 代码 · 共 33 行
CPP
33 行
/**************************************************
* p3_2.cpp *
* 将百分制的成绩按的等级分输出switch-case实现 *
**************************************************/
#include<iostream>
using namespace std;
void main()
{
int n;
cout<<"Enter a score:";
cin>>n;
switch(n/10)
{
case 9: case 10:
cout<<"The degree is A"<<endl;
break;
case 8:
cout<<"The degree is B"<<endl;
break;
case 7: case 6:
cout<<"The degree is C"<<endl;
break;
default:
cout<<"The degree is D"<<endl;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?