fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. struct Op
  6. {
  7. int e;
  8. Op(int e = 0) : e(e) {}
  9. } power_of;
  10.  
  11. int operator*=(int i, Op f)
  12. {
  13. return std::pow(i, f.e);
  14. }
  15.  
  16. Op operator*=(Op, int i)
  17. {
  18. return Op{i};
  19. }
  20.  
  21. #define $$ *=power_of*=
  22.  
  23. int main()
  24. {
  25. cout << (4 $$ 3 $$ 2); // prints 262144
  26. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
262144