标签:语言 turn break 输出 err case float clu core
给出一个百分制成绩,要求输出成绩等级A,B,C,D,E。90分以上为A,80~89分为B,70~79分为C,60~69分为D,60分以下为E.
#include<stdio.h>
int main()
{
float score;
int code;
scanf("%f",&score);
if (score >= 0 && score <= 100)
code = score / 10;
else
code = -1;
switch (code)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:printf("E"); break;
case 6:printf("D"); break;
case 7:printf("C"); break;
case 8:printf("B"); break;
case 9:
case 10 : printf("A"); break;
case -1:printf("Error!"); break;
}
return 0;
}
标签:语言 turn break 输出 err case float clu core
原文地址:https://www.cnblogs.com/old-horse/p/12470751.html