fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. int i;
  10. vector<int> ted;
  11.  
  12.  
  13. while (cin >> i && i != 0) {
  14. ted.push_back(i);
  15. }
  16.  
  17. sort(ted.begin(), ted.end());
  18.  
  19. for (int i = 0; i < ted.size(); i++) {
  20. cout << ted[i] << " ";
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5316KB
stdin
5 -5 2 -3 2 3 0

stdout
-5 -3 2 2 3 5