fork download
  1. #include<iostream>
  2. using namespace std ;
  3. int main(){
  4. int x, y , z ;
  5. cout << "Please give me the 3 numbers you wnat to sort ascending\n";
  6. cin >> x >> y >> z ;
  7. if ( x <= y && x <= z)
  8. cout << x << " " << min(y, z) << " " << max(y, z);
  9. else if ( y <= x && y <= z)
  10. cout << y << " " << min(x, z) << " " << max(x, z);
  11. else if ( z <= x && z <= y)
  12. cout << z << " " << min(x, y) << " " << max(x, y) ;
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5288KB
stdin
2 2 2
stdout
Please give me the 3 numbers you wnat to sort ascending
2 2 2