Finding the position of the max element

后端 未结 5 1848
感情败类
感情败类 2020-12-04 11:15

Is there a standard function that returns the position(not value) of the max element of an array of values?

For example:

Suppose I have an array like this:

5条回答
  •  無奈伤痛
    2020-12-04 11:39

    STL has a max_elements function. Here is an example: http://www.cplusplus.com/reference/algorithm/max_element/

提交回复
热议问题