fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a;
  7. cin >> a;
  8. int* arr = new int[a];
  9. for (int i = 0; i < a; i++){ cin >> arr[i]; }
  10. sort(arr, arr + a);
  11. for (int i = 0; i < a; i++){ cout << arr[i] << ' '; }
  12. }
Success #stdin #stdout 0s 5492KB
stdin
10
1 8 2 1 4 7 3 2 3 6
stdout
1 1 2 2 3 3 4 6 7 8