fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #define foo1( a ) (a * a)
  5.  
  6. inline int foo2( int a ) { return (a * a); }
  7.  
  8. inline int goo1( int x ) { return foo1(foo2(x)); }
  9.  
  10. inline int goo2( int& x ) { return x = foo2(foo1(x)); }
  11.  
  12. inline int goo3( int& x, int y ) { return foo2(foo1(y + 1)); }
  13.  
  14. inline void goo4( int& x, int y ) { x = foo1(foo2(y + 1)); }
  15.  
  16. int main()
  17. {
  18. int i = 2, j = 1;
  19.  
  20. cout << "foo1 = " << foo1( 1 + 2 ) << "\n";
  21. cout << "foo2 = " << foo2( 2 + 1 ) << "\n";
  22. cout << "goo1 = " << goo1( i ) << "\n";
  23. cout << "goo2 = " << goo2( j ) << "\n";
  24. cout << "goo3 = " << goo3( i, j ) << "\n";
  25. goo4( i, j );
  26. cout << "i = " << i << "\nj = " << j << "\n";
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
foo1 = 5
foo2 = 9
goo1 = 16
goo2 = 1
goo3 = 9
i = 16
j = 1