. Advertisement .
..3..
. Advertisement .
..4..
How to sort a vector in reverse c? Can you give me some suggestions?
Here is a suggestion from ITtutoria team for you#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 <>());
}
I guess the following solution would help