用switch语句实现:输入请高手帮我设计个程序“一个成绩(5分制),输出其等级。等级评定原则:5分为A,4分、3分为B,其余为C。”
如题
程序代码:#include <stdio.h>
int main(void)
{
int cj;
printf("Please enter the performance(0~5):");
while(scanf("%d",&cj)==1)
{
if(cj>5||cj<0)
printf("Pleas enter the true performance(0~5):");
else
{switch(cj)
{case 5:printf("The grade level is A.\n");
break;
case 4:
case 3:printf("The grade level is B.\n");
break;
default:printf("The grade level is C.\n");}
printf("Please enter the performance(0~5):");}
}
system("pause");
return 0;
}