解题思路:
用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语言代码)浏览:879 |
【数组的距离】 (C语言代码)浏览:728 |
成绩转换 (C语言代码)浏览:1005 |
用筛法求之N内的素数。 (C语言代码)浏览:1232 |
C语言训练-尼科彻斯定理 (C语言代码)浏览:463 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:1233 |
C语言训练-亲密数 (C语言代码)浏览:682 |
数字游戏 (C++代码)浏览:1178 |
简单的a+b (C语言代码)浏览:506 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:713 |