Horje
sort vector in reverse order c++ Code Example
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 <>());
}
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;
}




Cpp

Related
find maximum sum of circular subarray Code Example find maximum sum of circular subarray Code Example
how to put string in array c++ Code Example how to put string in array c++ Code Example
c++ formatting Code Example c++ formatting Code Example
what is c++ function Code Example what is c++ function Code Example
c++ preprocessor commands Code Example c++ preprocessor commands Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
14