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

BookBub brings you free & bargain national bestselling eBooks in the genres of your choice! Sign up now & join 1.5 million happy readers.
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
    全站熱搜
    創作者介紹
    創作者 jmuko103 的頭像
    jmuko103

    2016台北年菜推薦 年菜食譜 , 年菜預購 , 年菜2015 , 年菜訂購 , 7 eleven年菜訂購 , 年菜宅配 , 年菜菜單 , 年菜推薦 , 年菜食譜大全 , 年菜2016 , 年菜外帶 , 外帶年菜 台中

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