fork download
  1. #include <iostream>
  2.  
  3. #define Incr(x) (x + 1)
  4.  
  5. #define toSquare(x) \
  6. std::cout << #x << " to square is " << (x) * x << std::endl
  7.  
  8. int main()
  9. {
  10. int z = 3;
  11.  
  12. toSquare(2);
  13. toSquare(6);
  14. toSquare(Incr(z));
  15. toSquare(2+4);
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
2 to square is 4
6 to square is 36
Incr(z) to square is 16
2+4 to square is 16