Horje
sort(arr arr+n) in c++ Code Example
sort in descending order c++ stl
sort(arr, arr + n, greater<int>())
stl for sorting IN C++

// STL IN C++ FOR SORING
#include <bits/stdc++.h> 
#include <iostream> 
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);  // ASCENDING SORT
    reverse(arr,arr+n);   //REVERESE ARRAY 
    sort(arr, arr + n, greater<int>());// DESCENDING SORT
  } 
sort(arr arr+n) in c++
1 2 3 4 




Cpp

Related
c++ main function parameters Code Example c++ main function parameters Code Example
c to c++ converter online Code Example c to c++ converter online Code Example
glm multiply vector by scalar Code Example glm multiply vector by scalar Code Example
c++ multiple if conditions Code Example c++ multiple if conditions Code Example
c++ optimize big int array Code Example c++ optimize big int array Code Example

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