std sort function in C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    vector<int> v1 = {1, 6, 2, 5, 10, 4, 11, 3};
    sort(v1.begin(), v1.end(), greater<int>());
    for (auto el : v1)
    {
        cout << el << endl;
    }

    return 0;
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *