fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int add1( int &x )
  6. {
  7. x += 5, cout << "In function add1: the return value is x = " << x << endl; return x;
  8. }
  9.  
  10. int add2( int &x )
  11. {
  12. x += 10, cout << "In function add2: the return value is x = " << x << endl; return x;
  13. }
  14.  
  15. int main()
  16. {
  17. int x = 0, x1 = add1( x ), x2 = add2( x );
  18.  
  19. cout << x1 << " " << x2 << endl;
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
In function add1: the return value is x = 5
In function add2: the return value is x = 15
5 15