Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

get min and max element index from vector c++

int maxElementIndex = std::max_element(v.begin(),v.end()) - v.begin();
int maxElement = *std::max_element(v.begin(), v.end());

int minElementIndex = std::min_element(v.begin(),v.end()) - v.begin();
int minElement = *std::min_element(v.begin(), v.end());
Source by riptutorial.com #
 
PREVIOUS NEXT
Tagged: #min #max #element #index #vector
ADD COMMENT
Topic
Name
8+4 =