#356: 請問大家 這個哪裡錯了呢?


a222242 (無)


#include<iostream>
using namespace std;

int abc(int);

int main()
{
    int a;
    while(cin>>a)
    {
       if(abc(a))cout<<"質數"<<endl;
       else cout<<"非質數"<<endl;
    }
    system("pause");
    return 0;
}

int abc(int n)
{
    int b;
    for(b=2;b<n;b++)
       if(n%b==0)return 0;
    return 1;
}

#546: Re:請問大家 這個哪裡錯了呢?


jacky0102 (阿奇)


我剛入門不知道對不對,提出我覺得奇怪的地方,你的程式裡面出現了system("pause"); 不知道是不是因為這樣。
#5627: Re:請問大家 這個哪裡錯了呢?


tom159357 (水桶小鄭)


我剛入門不知道對不對,提出我覺得奇怪的地方,你的程式裡面出現了system("pause"); 不知道是不是因為這樣。

刪掉system("pause"); 拿去解題會逾時(1st)(TLE)
#5628: Re:請問大家 這個哪裡錯了呢?


leopan0922 (zz)


我剛入門不知道對不對,提出我覺得奇怪的地方,你的程式裡面出現了system("pause"); 不知道是不是因為這樣。

刪掉system("pause"); 拿去解題會逾時(1st)(TLE)

system("pause");不會造成TLE吧