Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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 :: random 1 diem tren man hinh bang dev c 
Cpp :: 123213 
Cpp :: How to assign two dimensional initializer list in c++ 
Cpp :: gcd 
Cpp :: c++ format number thousands separator 
Cpp :: temporary variable ex c++ 
Cpp :: how to display score using SDL in c++ 
Cpp :: namespace c++ 
Cpp :: android call custom managed method from native code 
Cpp :: how to read qlistwidget in c++ 
Cpp :: tic tac toe in cpp 
Cpp :: user inptu in cpp 
Cpp :: a variable with 2 independant variables plot 
Cpp :: cpp super 
Cpp :: intage1 was not declared in this scope C++ 
Cpp :: c++ convert const char* to LPCWSTR 
Cpp :: c++ remove last element from array 
Cpp :: if statement in c++ 
Cpp :: loop in c++ 
Cpp :: c++ return statement 
Cpp :: c++ error 0xC0000005 
Cpp :: c++ switch case statement 
C :: calculate distance between 2 points X Y axis 
C :: classification report to excel 
C :: how to print boolean in c 
C :: printf fill with 0 
C :: printf c float 
C :: silicon valley 
C :: how to empty string in c 
C :: union in c 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =