fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int arr[] = {0, 2, 1, -3, -5, 3, 1, 2}; //8 elements
  7. int *min_pointer = std::min_element(arr, arr+8);
  8. if (min_pointer == arr+8) return 0;
  9.  
  10. std::sort(min_pointer, arr+8);
  11.  
  12. for (int i=0; i!=8; i++)
  13. cout<<arr[i]<<endl;
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
0
2
1
-3
-5
1
2
3