Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to sort a vector in reverse c++

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