Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void swap(int &x, int &y)
  6. {
  7.  
  8. }
  9.  
  10. int main()
  11. {
  12. int x=5;
  13. int y=10;
  14. int& r_y = x;
  15. int& r_x = y;
  16.  
  17. cout << "Vorher: x= "<< x << " y = " << y << endl;
  18.  
  19. swap (x,y);
  20.  
  21. cout << "Nachher: x= "<< r_x << " y = " << r_y << endl;
  22.  
  23. cin.get();
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement