The outputs:
sort Array arr by order:
0 1 4 5 6 8 8
sort Array arr by reversed order:
8 8 6 5 4 1 0
The inputs:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> arr{1,4,8,5,0,6,8};
sort(arr.begin(), arr.end(), [](const int& l, const int& r) { return l < r; });
cout << " sort Array arr by order:" << endl;
for (int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
cout << endl;
sort(arr.begin(), arr.end(), [](const int& l, const int& r) { return l > r; });
cout << " sort Array arr by reversed order:" << endl;
for (int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
cout << endl;
return 0;
}