解题思路:
用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语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:1037 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:588 |
打水问题 (C语言代码)浏览:1106 |
【计算两点间的距离】 (C语言代码)浏览:1502 |
水仙花 (C语言代码)浏览:1123 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:540 |
C语言训练-大、小写问题 (C语言代码)浏览:685 |
简单的a+b (C语言代码)浏览:515 |
拆分位数 (C语言代码)浏览:538 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:600 |