Advertisement
RobertDeMilo

RB1.4 Темная сторона макросов

Apr 15th, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. //#define MY_MAIN int main()
  2. //#define FINISH return 0
  3. //
  4. //MY_MAIN
  5. //{
  6. //  FINISH;
  7. //}
  8.  
  9. //#include <iostream>
  10. //#include <iomanip>
  11. //#include <string>
  12. //using namespace std;
  13. //
  14. //#define AS_KV(x) #x << " = " << x  
  15. //
  16. //int main()
  17. //{
  18. //  int x = 4;
  19. //  string t = "hello";
  20. //  bool isTrue = false;
  21. //
  22. //  //cerr << " " << t << " " << isTrue << endl;
  23. //  cerr << boolalpha;
  24. //  cerr << AS_KV(x) << endl
  25. //      << AS_KV(t) << endl
  26. //      << AS_KV(isTrue) << endl;
  27. //}
  28.  
  29. //const string file = __FILE__;
  30. //const int line = __LINE__;
  31.  
  32. #include <iostream>
  33. #include <algorithm>
  34.  
  35. using namespace std;
  36.  
  37. //#define MAX(a, b) (a > b ? a : b)
  38. #define MAX(a, b) (a > b ? a : b)
  39. #define SQR(x) ((x) * (x))
  40.  
  41. int LogAndReturn(int x)
  42. {
  43.     cout << "x = " << x << endl;
  44.     return x;
  45. }
  46.  
  47. //template <typename T>
  48. //T Sqr(T x)
  49. //{
  50. //  return x * x;
  51. //}
  52.  
  53. int main()
  54. {
  55.     /*int x = 4;
  56.     int y = 2;
  57.  
  58.     int z = MAX(x, y) + 5;
  59.     cout << z;*/
  60.  
  61.     //int x = 3;
  62.     //int z = SQR(x + 1);
  63.     //int z = Sqr(x + 1);
  64.     //cout << z;
  65.  
  66.     int x = LogAndReturn(3);
  67.     int z = SQR(x++);
  68.     cout << z;
  69.  
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement