#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
//sort vector from largest to smallest in cpp
int n;
cout << "Enter size of vector: ";
cin >> n;
vector<int> v(n);
//fill vector
for (int i = 0; i < n; i++) cin >> v[i];
//sort
sort(v.begin(), v.end(),greater<int>());
//print vector
for (int i = 0; i < n; i++) cout << v[i] << " ";
cout << "
";
return 0;
}
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
//sort vector from smallest to largest in cpp
int n;
cout << "Enter size of vector: ";
cin >> n;
vector<int> v(n);
//fill vector
for (int i = 0; i < n; i++) cin >> v[i];
//sort
sort(v.begin(), v.end());
//print vector
for (int i = 0; i < n; i++) cout << v[i] << " ";
cout << "
";
return 0;
}