Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
Free Bestselling eBooks

It's easy: sign up in under 10 seconds, tell us what kind of eBooks you love & we'll email you a list of deals every day - FREE! Join now!
From our sponsors
c語言第幾次中止問題? while裡無法加continue?
Oct 17th 2013, 12:51

你的問題在於b++在if(a==b) continue之後.

當b累加到5那一次迴圈, 條件成立, 這個迴圈就直接返回while重新判斷b<=10. 之後b就永遠=5, if(a==b)永遠成立, 成為無限迴圈.

改成這樣就一樣了

#include<stdio.h>
int main(void)
{
int a,b=0;
printf("請問第幾次中止?(1~10)\n");
scanf("%d",&a);
while(b<10)
{b++;
if(a==b)
continue;
printf("第%d次處理\n",b);
}
system("pause");
return 0;
}

參考資料 每天和程式作伍的研究生

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends:

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 gyyci33a17tqf 的頭像
    gyyci33a17tqf

    繼承者們線上看, 繼承者們劇情, 繼承者們演員, 繼承者們13, 繼承者們插曲, 繼承者們15, 繼承者們14, 繼承者們 ost, 繼承者們 維基, 繼承者們第13集

    gyyci33a17tqf 發表在 痞客邦 留言(0) 人氣()