#6523: 不知道為什麼一直愈時


link0327 (ZH)


請大大指點,謝謝 
 
#include <iostream>
using namespace std;
int main()
{
   int box,tmp=1;
   
   while(cin >> box;) {
      for (int i=2;i<=(box/2);i++) {
         if (box % i == 0 && tmp == 1) {
            cout << "非質數\n";
            tmp=0;
         }
      }
      if (tmp == 1 ) 
         cout << "質數\n";
      tmp=1;
   }
   system("pause");
   return 0;
}

#6524: Re:不知道為什麼一直愈時


snail (蝸牛)


試試 2147483647 這個數字。
#6525: Re:不知道為什麼一直愈時


linishan (L)


然後
system("pause");
這行拿掉