fork download
  1. // C++ program to demonstrate default behaviour of
  2. // sort() in STL.
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int arr[] = {1, 5, 8, 9, 6, 7, 3, 4, 2, 0};
  9. int n = sizeof(arr)/sizeof(arr[0]);
  10.  
  11. sort(arr, arr+n);
  12.  
  13. cout << "\nArray after sorting using "
  14. "default sort is : \n";
  15. for (int i = 0; i < n; ++i)
  16. cout << arr[i] << " ";
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4208KB
stdin
Standard input is empty
stdout
Array after sorting using default sort is : 
0 1 2 3 4 5 6 7 8 9