close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
50% off Print Subscription of USA Today

Get the news delivered to your doorstep. Lock in the savings and receive USA Today for just $0.75 a day.
From our sponsors
c語言的小問題 求助
Mar 3rd 2014, 11:48

Q1
#include

int main() {
int n = 100;
for (int i = 2; i < n; i = i+1) {
bool not_prime = false;
for (int j = 2; j < i && !not_prime; j = j+1)
if (i%j == 0)
not_prime = true;
if (!not_prime) {
printf("%d is a prime\n", i);
}
}
return 0;
}
這條程是什麼意思...??為甚麼可以噴出質數??
bool not_prime = false;是蝦米.....

Q2
‪#‎include‬ <cstdio>
//52
int main () {
int n,i,t[1000],big[1]={0},i2=1;

scanf("%d",&n);

for(i2=i2;i2!=0;big[0]=0,i2=0)
{
for(i=0;i<n;i++)
{
scanf("%d",&t[i]);
}
for(i=0;i<n;i++)
{
if(t[i]>big[0])
big[0]=t[i];
}
for(i=0;i<n;i++)
{
if(big[0]==t[i])
t[i]=0;
}
for(i=0;i<n;i++)
{
printf("%d",t[i]);
if(i!=n-1)
printf(" ");
else
printf("\n");
}
for(i=0;i<n;i++)
if(t[i]!=0)
i2+=1;
}
}
這條......我打這樣第1層FOR迴圈不是可以執行很多次嗎.....為什麼只能1次.....

大大幫幫忙阿.......

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.

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
    全站熱搜
    創作者介紹
    創作者 nbv2eybn7a7ye 的頭像
    nbv2eybn7a7ye

    進擊的巨人14, 進擊的巨人線上看, 進擊的巨人漫畫, 進擊的巨人遊戲, 進擊的巨人 動畫, 進擊的巨人 線上漫畫, 進擊的巨人14線上看, 進擊的巨人13, 進擊的巨人 h, 進擊的巨人op

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