Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

min element c++

#include <algorithm>
#include <iostream>
#include <vector>
 
int main()
{
    std::vector<int> v{3, 1, 4, 1, 5, 9};
 
    std::vector<int>::iterator result = std::min_element(v.begin(), v.end());
    std::cout << "min element at: " << std::distance(v.begin(), result);
}
Source by en.cppreference.com #
 
PREVIOUS NEXT
Tagged: #min #element
ADD COMMENT
Topic
Name
2+4 =