Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to sort a vector in descending order in c++

//Method 1
sort(v.begin(),v.end(),greater<>());
//Method 2
//Multiply the vector with -1 and then sort it and again multiply it with -1.
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #sort #vector #descending #order
ADD COMMENT
Topic
Name
1+3 =