Advertisement
Kyosaur

Another C++ challange

Mar 10th, 2011
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. /*
  2.  
  3. C++ challanege! Complete this program in just one line (it tells you if a number if odd).
  4.  
  5.  
  6. Limitations:
  7.  
  8.     * No use of the Mod(%) operator
  9.     * no use of functions
  10.     * no use of classes
  11.     * no use of / * - +
  12.     * a line is counted by the amount of semicolons used. so your return statement counts as one line
  13.     * you cannot alter any other line in the code
  14.  
  15. */
  16.  
  17. #include <iostream>
  18. using namespace std;
  19.  
  20. bool isEven(int f)
  21. {
  22.     //finish this function in one line.
  23. }
  24.  
  25. int main (int argc, char * argv[])
  26. {
  27.     int f = 10;
  28.  
  29.     cout << f << ( isEven(f)  ?  " is even" : " is odd" ) << endl;
  30.  
  31.     system("pause");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement