Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Sort array using inbuilt sort function in decreasing order

// Sort(In Ascending Order) Array using Inbuilt Sort function
sort(arr, arr+n);
  
// Sort(In Ascending Order) Vector using Inbuilt Sort function
sort(arr.begin(), arr.end());

// Sort(In Descending Order) Array using Inbuilt Sort function
sort(arr, arr+n, greater<int>())
  
// Sort(In Descending Order) Vector using Inbuilt Sort function
sort(arr.begin(), arr.end(), greater<int>())
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to make a hello world program in c++ 
Cpp :: c++ loop through array 
Cpp :: how to play sound in c++ 
Cpp :: c++ cli convert string to string^ 
Cpp :: fork c 
Cpp :: removing a character from a string in c++ 
Cpp :: arduino notone 
Cpp :: 2d vector c++ declaration 
Cpp :: cpp split string by space 
Cpp :: C++ generate a random letter 
Cpp :: how to read wav file in C++ 
Cpp :: min element c++ 
Cpp :: pow in c++ 
Cpp :: return by reference in cpp 
Cpp :: c++ open file 
Cpp :: c++ char to uppercase 
Cpp :: multiline comment in c++ 
Cpp :: map in c++ sorted descending order 
Cpp :: loop through a vector in c++ 
Cpp :: how print fload wiht 2 decimal in c++ 
Cpp :: fstring from float c++ ue4 
Cpp :: cpp initialize multidimensional vector 
Cpp :: push_back struct c++ 
Cpp :: why we use iostream in C++ programming 
Cpp :: c++ reference 
Cpp :: reading file c++ 
Cpp :: lutris 
Cpp :: c++ how to add something at the start of a vector 
Cpp :: throw exception c++ 
Cpp :: how to find last character of string in c++ 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =