【问题描述】 输入五级制成绩(A~E),输出相应的百分制成绩(0~100)区间,要求使用switch语句。
发布网友
发布时间:2022-04-26 17:06
我来回答
共2个回答
热心网友
时间:2023-10-16 03:46
#include <stdio.h>
int main(int argc,char *argv[]){
char ch;
printf("Input Grade: ");
scanf(" %c",&ch);
switch(ch){
case 'A': printf("%c is 90-100\n",ch); break;
case 'B': printf("%c is 80-99\n",ch); break;
case 'C': printf("%c is 70-89\n",ch); break;
case 'D': printf("%c is 60-69\n",ch); break;
case 'E': printf("%c is 0-59\n",ch); break;
default: printf("Error\n"); break;
}
return 0;
}
热心网友
时间:2023-10-16 03:46
main()
{
char score;
printf("Input Grade: ");
scanf("%c",&score);
switch(score)
{
case 'A':printf("%c is 90-100",score);break;
case 'B':printf("%c is 80-89",score);break;
case 'C':printf("%c is 70-79",score);break;
case 'D':printf("%c is 60-69",score);break;
case 'E':printf("%c is 0-59",score);break;
default:printf("error");
}
}