Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void zamiana (int *x, int *y)
  6. {
  7.     int z = *x;
  8.     *x = *y;
  9.     *y = z;
  10. }
  11.  
  12. int main()
  13. {
  14.     int a;
  15.     int b;
  16.     cout << "Podaj wartosc a: " << endl;
  17.     cin >> a;
  18.     cout << "Podaj wartosc b: " << endl;
  19.     cin >> b;
  20.  
  21.     cout << "Przed zmina wartosc a wynosi " << a << ", natomiast wartosc b wynosi " << b << endl;
  22.  
  23.     zamiana(&a, &b);
  24.  
  25.     cout << "a = " << a << endl;
  26.     cout << "b = " << b << endl;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement