int arr[10];
int length = sizeof(arr)/sizeof(arr[0]);
sort(arr, arr+length, greater<int>());
sort(arr, arr + n, greater<int>())
// C++ program to demonstrate descending order sort using
// greater<>().
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
int n = sizeof(arr) / sizeof(arr[0]);
sort(arr, arr + n, greater<int>());
cout << "Array after sorting :
";
for (int i = 0; i < n; ++i)
cout << arr[i] << " ";
return 0;
}
sort(arr, arr + n, greater<int>());
sort(str.begin(), str.end(), greater<int>());
cout<<str;
sort(begin(arr), end(arr), greater<>())
Code Example |
---|
Cpp :: should i learn c or c++ |
Cpp :: c++ convert binary string to decimal |
Cpp :: master header file c++ |
Cpp :: c++ set console title |
Cpp :: bits/stdc++.h visual studio |
Cpp :: qt qlcdnumber change value |
Cpp :: uri online judge 1930 solution in c++ |
Cpp :: ue4 c++ array |
Cpp :: what are specialized classes c++ |
Cpp :: insert at position in vector c++ |
Cpp :: change const value c++ |
Cpp :: cpp iterate words from string |
Cpp :: cout hex value |
Cpp :: qt messagebox |
Cpp :: rotate in cpp |
Cpp :: c++ srand() |
Cpp :: how can I replace a pattern from string in c++ |
Cpp :: Area of a Circle in C++ Programming |
Cpp :: how to hide ui elements unity |
Cpp :: binary exponentiation modulo m |
Cpp :: retu7rn this c++ |
Cpp :: fork c |
Cpp :: structure and function c++ |
Cpp :: cpp mst |
Cpp :: min vector c++ |
Cpp :: conditional operator in cpp |
Cpp :: srand() c++ |
Cpp :: c++ hide show console |
Cpp :: c++ nested switch statements |
Cpp :: c++ 2d vector assign value |