Guest User

Untitled

a guest
Feb 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. void zamien_miejscami (int &x, int &y)
  6. {
  7. int temp = x;
  8. x = y;
  9. y = temp;
  10. }
  11.  
  12. int main ()
  13. {
  14. int a, b, c, d ;
  15. cout << "POdaj wartosci a, b, c, d";
  16. cin >> a >> b >> c >> d;
  17. if (a > b) zamien_miejscami (a,b);
  18. if (a > c) zamien_miejscami (a,c);
  19. if (b > c) zamien_miejscami (b,c);
  20. if (a > d) zamiena_miejscami (a,d);
  21. if (b > d) zamien_miejscami (b,d);
  22. if (c > d) zamien_miejscami (c,d);
  23. cout << "Wartosci liczb a, b, c po zamianach: " << a << " " << b << " "<< c << " " << d;
  24. cin.ignore ();
  25. getchar ();
  26. return 0;
  27. }
Add Comment
Please, Sign In to add comment