Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- using namespace std;
- void zamien_miejscami (int &x, int &y)
- {
- int temp = x;
- x = y;
- y = temp;
- }
- int main ()
- {
- int a, b, c, d ;
- cout << "POdaj wartosci a, b, c, d";
- cin >> a >> b >> c >> d;
- if (a > b) zamien_miejscami (a,b);
- if (a > c) zamien_miejscami (a,c);
- if (b > c) zamien_miejscami (b,c);
- if (a > d) zamiena_miejscami (a,d);
- if (b > d) zamien_miejscami (b,d);
- if (c > d) zamien_miejscami (c,d);
- cout << "Wartosci liczb a, b, c po zamianach: " << a << " " << b << " "<< c << " " << d;
- cin.ignore ();
- getchar ();
- return 0;
- }
Add Comment
Please, Sign In to add comment