我的程序在vc++上不能运行,请高手指点下是goto用错了吗?只想用goto做哈
#include<stdio.h>main(){intt,q,w,a[2][5]={150001,150002,150003,150004,150005,1000,500...
#include<stdio.h>
main()
{ int t,q,w,a[2][5]={150001,150002,150003,150004,150005,1000,500,230,700,998};
re:printf("请输入您要查询的零件编号:\n");
scanf("%d",&t);
if((t>150005)||(t<150001))
{printf("您输入的是错误的零件编号,请选择重新输入(Y),退出查询(N)");
scanf("%d",&q);
if(q='Y')
goto re;
if(q='N')
goto end;}
else
printf("%d %d",a[0][t-150001],a[1][t-150001]);
printf("您还要继续查询吗(Y/N)?");
scanf("%c",&w);
if(w='Y')
goto re;
if(w='N')
goto end;
end:printf("查询结束");
} 展开
main()
{ int t,q,w,a[2][5]={150001,150002,150003,150004,150005,1000,500,230,700,998};
re:printf("请输入您要查询的零件编号:\n");
scanf("%d",&t);
if((t>150005)||(t<150001))
{printf("您输入的是错误的零件编号,请选择重新输入(Y),退出查询(N)");
scanf("%d",&q);
if(q='Y')
goto re;
if(q='N')
goto end;}
else
printf("%d %d",a[0][t-150001],a[1][t-150001]);
printf("您还要继续查询吗(Y/N)?");
scanf("%c",&w);
if(w='Y')
goto re;
if(w='N')
goto end;
end:printf("查询结束");
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询