View Single Post
Old Jan 22nd, 2008, 1:40 PM   #19
peaceofpi
hi: for(;;) goto hi;
 
peaceofpi's Avatar
 
Join Date: Jun 2006
Posts: 93
Rep Power: 3 peaceofpi is on a distinguished road
Send a message via AIM to peaceofpi Send a message via MSN to peaceofpi
Re: Exception handling: point is...?

Factors of 2: 1, 2, ?

As for grumpy
Quote:
Originally Posted by grumpy
That code would be thrown out in any serious code review
Quote:
Originally Posted by me
How's this for a first attempt?
I got my answer, I guess I should have known better than to ask further questions.

Regardless,
c++ Syntax (Toggle Plain Text)
  1. bool isprime(int n)
  2. {
  3. if (n <= 1) return false;
  4. if (n == 2) return true; // stays till someone comes up with another factor of 2
  5. for (int i = 3; i <= n/2; i++)
  6. if (n % i == 0)
  7. return false;
  8. return true;
  9. }
__________________
How do you play Religious Roulette?
Stand around in a circle and blaspheme till someone gets struck by lightning.
peaceofpi is offline   Reply With Quote