检查不出问题,请大家不吝赐教。
/*output the student score in A,B,C,D,E class*/#include<stdio.h>
#include<stdlib.h>
int main()
{
int score;
char ch;
test:{
printf("please input the score: ");
scanf("%d",&score);
if(score>=90)
ch='A';
else if(score>=80&&score<=89)
ch='B';
else if(score>=70&&score<=79)
ch='C';
else if(score>=60&&score<=69)
ch='D';
else
ch='E';
printf("this student score is : %c class\n",ch);
test2: {
printf("continue the test , Y/N ? : ");
char judge='Y';
scanf("%c",&judge);
if(judge=='Y'||judge=='y')
goto test;
else if(judge=='N'||judge=='n')
exit(0);
else
printf("Error :wrong input!!!!!!!! \n");
goto test2;
}
}
return 0;
}
输入23后,运行结果
please input the score: 23
this student score is : E class
continue the test , Y/N ? : Error :wrong input!!!!!!!!
continue the test , Y/N ? :
请大家分析一下为什么会出现continue the test , Y/N ? : Error :wrong input!!!!!!!!