csansoon

P4.03 P65437 Swap

Oct 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void swap2(int& a, int& b) {
  5.     int c=a;
  6.     a=b;
  7.     b=c;
  8. }
  9.  
  10. int main(){
  11.     int x,y;
  12.     cin >> x >> y;
  13.     swap2(x,y);
  14.     cout << x << " " << y << endl;
  15. }
Add Comment
Please, Sign In to add comment