Search
 
SCRIPT & CODE EXAMPLE
 

CPP

reverse sort cpp


int main(){    
  	int arr[5] = {1,3,2,4,5};
	sort(arr, arr+5, greater<int>()); 
  	// arr == {5,4,3,2,1}
  	return 0;
}
Comment

how to sort in descending order c++

int arr[10];
int length = sizeof(arr)/sizeof(arr[0]); 
sort(arr, arr+length, greater<int>());
Comment

sort in descending order c++ stl

sort(arr, arr + n, greater<int>())
Comment

sort function descending c++

// 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;
}
Comment

c++ descending sort

sort(arr, arr + n, greater<int>());
Comment

how to sort in descending order in c++

sort(str.begin(), str.end(), greater<int>());
cout<<str;
Comment

descending order c++

sort(begin(arr), end(arr), greater<>())
Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ Changing Default Value of Enums 
Cpp :: variable modulus 5 meaning in c++ 
Cpp :: error c4001 site:docs.microsoft.com 
Cpp :: nmake.exe is not found in the windows 
Cpp :: c++ optimize big int array 
Cpp :: turbo c++ easy programs 
Cpp :: ++m in c 
Cpp :: sfml thread multi argument function 
Cpp :: c++ stoi binary negative number string to decimal 
Cpp :: string in int in cpp 
Cpp :: pointers mcq sanfoundry 
Cpp :: Shuffle String leetcode solution in cpp 
Cpp :: how to use string in if else statement c++ 
Cpp :: vector with initial size 
Cpp :: C++ Automatic Conversion from double to int 
Cpp :: vector literal in cpp 
Cpp :: foo foo little dogs 
Cpp :: how to add values in empty array using python 
Cpp :: deliberation meaning 
Cpp :: c++ define function in header 
Cpp :: C++ OpenCV Face Recognition 
Cpp :: crtdbg c++ 
Cpp :: last element of a set in c++ 
Cpp :: C++ if...else 
Cpp :: fabs in c++ example 
Cpp :: interactive problem 
Cpp :: std 
Cpp :: time optimisation c++ 
Cpp :: c++ copy pointer vector to static 
Cpp :: 2160. Minimum Sum of Four Digit Number After Splitting Digits leetcode solution in c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =