sorting in decreasing order in cpp code example
Example 1: sort in descending order c++ stl
sort(arr, arr + n, greater<int>())
Example 2: sort inbuilt function in c++
#include <bits/stdc++.h>
using namespace std;
#define size(arr) sizeof(arr)/sizeof(arr[0]);
int main(){
int a[5] = {5, 2, 6,3 ,5};
int n = size(a);
sort((a), a + n);
for(int i = 0; i < n; i++){
cout << a[i];
}
return 0;
}