调用函数和循环
#include <stdio.h>#include <stdlib.h>
int main()
{
int grade=-1;
char gradeLevel='A';
char getGradeLevel(int grade);
while(1)
{
printf("请输入成绩:");
scanf("%d",&grade);
gradeLevel=getGradeLevel(grade);
printf("成绩%d的等级是%c\n",grade,gradeLevel);
if(grade!=0)
continue;
else
break;
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
char getGradeLevel(int grade)
{
int score;
switch(score)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
printf("E");
case 6:
printf("D");
case 7:
printf("C");
case 8:
printf("B");
case 9:
case 10:
printf("A");
}
if(grade<0||grade>100)
return (score);
}
各位大神帮忙看看是哪里出问题了,谢谢