close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
Looking for something light while keeping you safe and comfortable during extended waterside activities?

Shop New Drainmaker Shoe for Men, Women and Kids at Columbia!
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
    全站熱搜
    創作者介紹
    創作者 kkoki0httzobg 的頭像
    kkoki0httzobg

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

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