1#include <iostream>
2#include <vector>
3#include <algorithm>
4using namespace std;
5int main() {
6 vector<int> v = { 10, 9, 8, 6, 7, 2, 5, 1 };
7 sort(v.begin(), v.end(), greater <>());
8}
1int main()
2{
3 // Get the vector
4 vector<int> a = { 1, 45, 54, 71, 76, 12 };
5
6 // Print the vector
7 cout << "Vector: ";
8 for (int i = 0; i < a.size(); i++)
9 cout << a[i] << " ";
10 cout << endl;
11
12 // Sort the vector in descending order
13 sort(a.begin(), a.end(), greater<int>());
14
15 // Print the reversed vector
16 cout << "Sorted Vector in descendiing order:n";
17 for (int i = 0; i < a.size(); i++)
18 cout << a[i] << " ";
19 cout << endl;
20
21 return 0;
22}