关于switch语句 求真相switch(m)\x05{\x05case 1:head=create();goto A;\x05case 2:InsertPoint(head);goto A;\x05case 3:DelPoint(head);goto A;\x05case 4:print(head);goto A;\x05case 5:printf("Quit?\n");\x05\x05printf("Y for YES else for return\n");\x

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 19:11:40

关于switch语句 求真相switch(m)\x05{\x05case 1:head=create();goto A;\x05case 2:InsertPoint(head);goto A;\x05case 3:DelPoint(head);goto A;\x05case 4:print(head);goto A;\x05case 5:printf("Quit?\n");\x05\x05printf("Y for YES else for return\n");\x
关于switch语句 求真相
switch(m)
\x05{
\x05case 1:head=create();goto A;
\x05case 2:InsertPoint(head);goto A;
\x05case 3:DelPoint(head);goto A;
\x05case 4:print(head);goto A;
\x05case 5:printf("Quit?\n");
\x05\x05printf("Y for YES else for return\n");
\x05\x05scanf("%c",&c);
\x05\x05if(c=='Y'||c=='y')
\x05\x05\x05exit (0);
\x05\x05else\x05goto A;
\x05default:printf("you chose wrong date\n");goto A;
\x05}为什么这段代码没有执行scanf 直接跳过scanf执行了goto

关于switch语句 求真相switch(m)\x05{\x05case 1:head=create();goto A;\x05case 2:InsertPoint(head);goto A;\x05case 3:DelPoint(head);goto A;\x05case 4:print(head);goto A;\x05case 5:printf("Quit?\n");\x05\x05printf("Y for YES else for return\n");\x
不知道你前面还有没有类似scanf之类的输入函数,有的话就在case5 的scanf之前加一句
getchar();