Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Oops this post was deleted due to me accidentally specifying 1 day as the expire time. Sorry!
- /*
- C++ challanege! Complete this program in just one line (it tells you if a number if odd).
- Limitations:
- * No use of the Mod(%) operator
- * no use of functions
- * no use of classes
- * no use of / * - +
- * a line is counted by the amount of semicolons used. so your return statement counts as one line
- * you cannot alter any other line in the code
- */
- #include <iostream>
- using namespace std;
- bool isEven(int f)
- {
- //finish this function in one line.
- return !(f & 1);
- }
- int main (int argc, char * argv[])
- {
- int f = 10;
- cout << f << ( isEven(f) ? " is even" : " is odd" ) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement