Re: [問題] 新手問題 要怎麼讓某段算式重複?
#include <stdio.h>
#include <stdlib.h>
//依造自己需求修改
//初始設定b=1為輸入正確
//b=2 為輸入錯誤
//b=3 跳脫迴圈
int main(int argc, char *argv[])
{
int a,b;
a=1;
aaa:
printf("請輸入第%d次算式:",a);
scanf("%d",&b);
if(b==1)
{
a++;
goto aaa;
}else if(b==2)
goto aaa;
system("PAUSE");
return 0;
}
真的只能用goto去解
--
網誌文章(慎入):http://ppt.cc/NYed
學習,就要思考它的價值:http://ppt.cc/NQrD
電競,是必要的嗎:http://ppt.cc/3n4g
鬥棋(小說):http://ppt.cc/WPqF
殘局PK戰:http://ppt.cc/FpGm
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.1.171
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1412507332.A.888.html
推
10/05 19:49, , 1F
10/05 19:49, 1F
→
10/05 19:54, , 2F
10/05 19:54, 2F
推
10/09 16:11, , 3F
10/09 16:11, 3F
推
10/09 18:37, , 4F
10/09 18:37, 4F
→
10/09 18:38, , 5F
10/09 18:38, 5F
推
10/11 11:21, , 6F
10/11 11:21, 6F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):