Advertisement

Odds or Even baby...

Started by May 28, 2000 12:38 AM
10 comments, last by jLeslie 24 years, 7 months ago
The code looks great, and I''m planning on using a maximized version of this...
some errors in there
lemme fix your program


class isEven
{
private:
int value;
public:
isEven(int num) : value(num) {}
operator bool() { return value&1; }
};
class isOdd
{
private:
int value;
public:
isOdd(int num) : value(num) {}
operator bool() { return !isEven(value); }
};

void main()
{
int x=...;
if (isEven(x))
// x is even
else
// x is odd
}


- pouya
--------------
The trick to flight is to throw yourself at the ground and miss!!!


Edit: sorry, the font size was TOO big the first time



Edited by - pouya on May 29, 2000 6:13:33 PM

This topic is closed to new replies.

Advertisement