chillurbrain

Task1_7_1

Dec 21st, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. void swap(int* x, int* y)
  8. {
  9.     int temp = *x;
  10.     *x = *y;
  11.     *y = temp;
  12. }
  13.  
  14. int main()
  15. {
  16.     int x;
  17.     int y;
  18.     cin >> x;
  19.     cin >> y;
  20.     int* a = &x;
  21.     int* b = &y;
  22.     swap(a, b);
  23.     cout << x << endl << y;
  24.     _getch();
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment