#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v = { 10, 9, 8, 6, 7, 2, 5, 1 };
sort(v.begin(), v.end(), greater <>());
}
//Method 1
sort(v.begin(),v.end(),greater<>());
//Method 2
//Multiply the vector with -1 and then sort it and again multiply it with -1.
sort(a.begin(), a.end(), greater<int>());
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> vec = { 7, 3, 5, 1, 9 };
std::sort(vec.rbegin(), vec.rend());
// do anything
return 0;
}
vector<int> v = { 10, 9, 8, 6, 7, 2, 5, 1 };
sort(v.begin(), v.end(), greater <>());