解题思路:
用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语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1054 |
【出圈】 (C语言代码)浏览:807 |
C二级辅导-统计字符 (C语言代码)浏览:489 |
神奇的fans (C语言代码)浏览:1021 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:601 |
快速排序算法1浏览:915 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:452 |
母牛的故事 (C语言代码)浏览:497 |
【数组的距离】 (C语言代码)浏览:538 |
【出圈】 (C语言代码)浏览:728 |