minimum values in an array

i need to find the minimum values in an array and print the indexs corresponding to the elements out.
There are identical minimum values in a array,the size of the array is unknown. how can i find and print the indexs corresponding to the elements out?
well you could sort the array then the minimum value will always be the first element.

//sort algorithm
http://www.cplusplus.com/reference/algorithm/sort/

//there is also the min_element function which returns an iterator to the min element.
http://www.cplusplus.com/reference/algorithm/min_element/
Sorting changes indices, so it seems inappropriate.

std::min_element returns the location of first minimal element. It is trivial to find the rest.

std::distance helps changing iterator into index.
Topic archived. No new replies allowed.