scanf命令什么时候失效?
main(){char choice;
loop:
printf("\nwhat do u want:\nc for creat i for insert d for del q for exit \n");
scanf("%c",&choice);
switch(choice)
{case 'c':
printf("================creat=======================\n");
break;
case 'i':
printf("================input========================\n");
break;
case 'd':
printf("================del==========================\n");
break;
case 'q':
exit(0);
default:
printf("================error========================\n");
}
goto loop;
}
运行的时候,总是多了两行
nwhat do u want:\nc for creat i for insert d for del q for exit
================error========================
??????????????????????????