Advertisement
DaniDori

Сортировка 3х

Jan 19th, 2023
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void sort(int &a, int &b, int &c) {
  5.     int min, centr, max;
  6.     if (a >= b and b>=c) {
  7.         max = a;
  8.         centr = b;
  9.         min = c;
  10.     }
  11.     //Добавить другие случаи
  12.     a = min;
  13.     b = centr;
  14.     c = max;
  15. }
  16.  
  17. int main()
  18. {
  19.     int x, y, z;
  20.     cin >> x >> y >> z;
  21.     sort(x, y, z);
  22.     cout << x << " " << y << " " << z;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement