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++)
  10. {
  11. cin >> arr[i];
  12. }
  13. sort(arr, arr + a);
  14. for (int i = 0; i < a; i++)
  15. {
  16. cout << arr[i] << ' ';
  17. }
  18. }
Success #stdin #stdout 0s 4780KB
stdin
10
1 8 2 1 4 7 3 2 3 6
stdout
1 1 2 2 3 3 4 6 7 8