关于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/06/22 00:30:54
![关于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(](/uploads/image/z/12462586-34-6.jpg?t=%E5%85%B3%E4%BA%8Eswitch%E8%AF%AD%E5%8F%A5+%E6%B1%82%E7%9C%9F%E7%9B%B8switch%28m%29%5Cx05%7B%5Cx05case+1%3Ahead%3Dcreate%28%29%3Bgoto+A%3B%5Cx05case+2%3AInsertPoint%28head%29%3Bgoto+A%3B%5Cx05case+3%3ADelPoint%28head%29%3Bgoto+A%3B%5Cx05case+4%3Aprint%28head%29%3Bgoto+A%3B%5Cx05case+5%3Aprintf%28%22Quit%3F%5Cn%22%29%3B%5Cx05%5Cx05printf%28%22Y+for+YES+else+for+return%5Cn%22%29%3B%5Cx)
关于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();