解题思路:
用string数组存储字符串
注意事项:
参考代码:
#include <iostream>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <string>
#include <cmath>
#include <cstdlib>
#include <string.h>
using namespace std;
int main()
{
string str[1001];
int n,i=0;
while(cin>>n)
{
if(n<=100&&n>=90)
{
str[i]="A";
}
else if(n>=80&&n<90)
{
str[i]="B";
}
else if(n>=70&&n<80)
{
str[i]="C";
}
else if(n>=60&&n<70)
{
str[i]="D";
}
else if(n>=0&&n<60)
{
str[i]="E";
}
else
{
str[i]="Score is error!";
}
i++;
}
for(int j=0;j<i;j++)
{
cout<<str[j]<<endl;
}
return 0;
}
0.0分
0 人评分
【蟠桃记】 (C++代码)(递归计算)浏览:981 |
C语言训练-阶乘和数* (C语言代码)浏览:1036 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:639 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1160 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:548 |
矩阵乘法 (C++代码)浏览:1510 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:771 |
C语言训练-求函数值 (C语言代码)浏览:586 |
WU-蓝桥杯算法提高VIP-勾股数 (C++代码)浏览:1619 |
三角形 (C++代码)记忆化搜索浏览:1249 |