早教吧作业答案频道 -->其他-->
关于switch语句求真相switch(m)\x05{\x05case1:head=create();gotoA;\x05case2:InsertPoint(head);gotoA;\x05case3:DelPoint(head);gotoA;\x05case4:print(head);gotoA;\x05case5:printf("Quit?\n");\x05\x05printf("YforYESelseforreturn\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(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
▼优质解答
答案和解析
不知道你前面还有没有类似scanf之类的输入函数,有的话就在case5 的scanf之前加一句
getchar();
getchar();
看了 关于switch语句求真相s...的网友还看了以下:
两题单链表逆置,求讲解1.p=head->next;head->next=NULL;while(p 2020-06-15 …
关于switch语句求真相switch(m)\x05{\x05case1:head=create( 2020-06-21 …
inta[]={1,2,3,4,5,6,7,8,9,0};printf("%x\n",a);pri 2020-07-18 …
求下列广义表运算的结果(1)head((p,h,w));(2)tail((b,k,p,h));(3 2020-07-18 …
设3个广义表为:A=(a,b,c),B=(A,(c,d)),C=(a,(B,A),(e,f)),请 2020-07-18 …
main(){intg;printf("Enteramark:");scarf("%d",&g); 2020-07-25 …
4.10输出星期几的英文表示switch语句}#includevoidmain(){intn;sc 2020-08-03 …
C#考题中的一道题——功能与其他语句不同A)if(a)printf("%d\n",x);elsepr 2020-12-13 …
显示/etc/passwd文件的第11-20行,:显示/etc/passwd文件的第11-20行,其 2020-12-14 …
若有定义floatw;inta,b;,则合法的switch语句是()。(1分)A、switch(w) 2021-01-13 …