Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sort vector in reverse order c++

#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;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #sort #vector #reverse #order
ADD COMMENT
Topic
Name
8+2 =