退出来怎么弄???
//成绩打印0-100,输入X可以退出//#include<stdio.h>
void main()
{
int grade,leve,loop;
char v='X';
loop:printf("input a number:\ngrade=");
scanf("%d",&grade);
while(grade>100||grade<0)
{
printf("重新输入正确的数\ngrade=");
scanf("%d",&grade);
}
leve=grade/10;
switch(leve)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:printf("成绩等级:E\n");break;
case 6:printf("成绩等级:D\n");break;
case 7:printf("成绩等级:C\n");break;
case 8:printf("成绩等级:B\n");break;
default :printf("成绩等级:A\n");
}
goto loop;
}
这个写的是正确,但是我想输入‘X’按回车键能自动退出,请各位帮帮忙啊!