请高手 帮忙做一道c语言题 编程,把百分制成绩转换成5级记分制,要求用switch语句。 90分以上(包括90):

供稿:hz-xin.com     日期:2025-01-12
C语言编程,把百分制成绩转换成5级记分制,要求用switch语句.

#include
#include

int main()
{
float s;
char c;

scanf("%f",&s);
switch((int)s/10)
{
case 10:
case 9:
c='A';
break;
case 8:
c='B';
break;
case 7:
c='C';
break;
case 6:
c='D';
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
c='E';
break;
default:
c='E';
break;
}
printf("%.1f:%c",s,c);
return 0;
}


具体方法与演示结果如图:

#include "stdio.h"
#include "stdlib.h"

int main()
{
int score,level;
char band;
printf("Input Score:");
scanf("%d",&score);
level=score/10;
switch(level)
{
case 10:
case 9: band='A'; break;
case 8: band='B'; break;
case 7: band='C'; break;
case 6: band='D'; break;
default: band='E'; break;
}
printf("%d的等级为%c\n",score,band);
system("pause");
return 0;
}

#include<stdio.h>
main()
{
int s,y;
y=(int)(s/10);
printf("Input Score:");
scanf(“%d”.&s);
switch(y)
{
case 9:case 10: printf("%d的等级为A",s);break;
case 8: printf("%d的等级为B",s);break;
case 7: printf("%d的等级为C",s);break;
case 6: printf("%d的等级为D",s);break;
default: printf("%d的等级为E",s);
}
}

#include "iostream.h"
#include "stdio.h"
void main()
{
int a;
cin>>a;

int b=a/10;
switch (b)
{
case 10:
cout<<"A"<<endl;
case 9:
cout<<"A"<<endl;
case 8:
cout<<"B"<<endl;
case 7:
cout<<"C"<<endl;
case 6:
cout<<"D"<<endl;
default:
cout<<"E"<<endl;
}
}

在switch前面加个b=成绩%10
然后switch(b)

这样的话输入108也会输出A而不是输出错误

请高手用C语言帮忙做个编程的题目,谢谢了!
int IsDevided(int number,int dev){ if(number %dev == 0){ return 1;} return 0;} void EasyDone(int a){ int chose;int i,j;printf("Input your chose\\n1>能被3整除的"<Enter 1>","\\n2>能被5整除的<Enter 2>","\\n3>能被3或5整除的<Enter 3>\\n");scanf("%d",&chose)...

请高手 帮忙做一道c语言题 编程,把百分制成绩转换成5级记分制,要求用sw...
} printf("%d的等级为%c\\n",score,band);system("pause");return 0;}

c语言编程题,请高手帮忙做一下,拜谢,急急急急……
1.include <stdio.h> double funcPi(int);int main(void){ int arg;printf("Input the argument: ");\/\/ \/\/ 无异常输入 \/\/ while (!scanf("%d", &arg)){ printf("Check your input and retry: ");while (getchar()!='\\n'){ continue;} } while (getchar()!='\\n'){ continue...

C语言简单编程题目两道,求高手做一下。高分!!!
第1题 :include <stdio.h> include <stdlib.h> define MAX 200 int main(void){ int a[MAX], i = 0;srand(time(NULL)); \/\/ 时间种子, 保证真随机, 每次不会相同 while (i < MAX) { a[i] = rand() % 10000; \/\/ 随机获得10000以下数字, 0-9999 if (a[i] < 1000) { ...

几道简单的C语言编程题,请高手帮忙
void main(){ int i,element,sum=0;for(i=1;i<=101;i+=2){ element=-i;sum=sum+element;sum=-sum;} printf("%d\\n",sum);} 2、编写程序,判断一个数是否是素数。6n+1,6n-1法代码 include<stdio.h> int main(){ int data[5]={2,3,5,7};int n;scanf("%d",&n);if(n=...

跪求编程大神~用c语言编个程序
下面是我做过的题目,算法思想树上已经说的很详细了,我就给代码哈。题目描述输入二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列。输入第一行输入二叉树的先序遍历序列;第二行输入二叉树的中序遍历序列。输出输出该二叉树的后序遍历序列。示例输入ABDCEFBDAECF示例输出DBEFCA include...

请各位高手帮忙做几道c语言的编程题
c = i%100\/10;d = i%10;m = a*10+b;n = c*10+d;if((m+n)*(m+n) == i)printf("%d ",i);} } (4)include <stdio.h> void main(){ int a[10]={0,1,2,3,4,5,6,7,8,9,};int i,j;int t;for (i=0; i<10; i++){ printf("%d ",a[i]);} cout<<...

c语言编程高手请进:麻烦帮忙解决下面这个菜鸟级的问题!(两个问题...
首先:#include"stdio.h"int fun(int i, int n){ int m=1;for(int j=0;j0){ a=j%10;if(a%7==0)s++;j=j\/10;} printf(" %d中有%d个7",x,s);}

C语言高手帮忙解决,急~~~(编程),要全部过程喔,题目如补充所示
int main(){ int i,j,D=0,d=0,s=0,q=0;char a;while(scanf("%c",&a) && a!='!'){ if(a>='A' && a<='Z') ++D;else if(a>='a' && a<='z') ++d;else if(a>='0' && a<='9') ++s;else ++q;} printf("大写字母:%d\\n小写字母:%d\\n数字:%d\\n其他...

C语言编程求助!!!求高手帮忙!感激不尽!
int main(){ int i,s = 0; \/*请修改此处:int和i间有空格; 计算的和值s首先要清零 *\/ char str[80];i=0;while ((str[i]=getchar())!='\\n')i++;str[i]='\\0';for(i=0;i<80;i++)if (str[i]>='0' && str[i]<='9') \/*请修改此处:应该是同时满足这两个...