Check out example codes for "c++ max and min of vector". It will help you in understanding the concepts better.

Code Example 1

*max_element(a.begin(), a.end());

Code Example 2

*min_element(a.begin(), a.end());

Code Example 3

#include <iostream>
#include <algorithm>

template <typename T, size_t N> const T* mybegin(const T (&a)[N]) { return a; }    
template <typename T, size_t N> const T* myend  (const T (&a)[N]) { return a+N; }

int main()
{
    const int cloud[] = { 1,2,3,4,-7,999,5,6 };

    std::cout << *std::max_element(mybegin(cloud), myend(cloud)) << '\n';
    std::cout << *std::min_element(mybegin(cloud), myend(cloud)) << '\n';
}

Code Example 4

template <typename T, size_t N> const T* mybegin(const T (&a)[N]) { return a; }    
template <typename T, size_t N> const T* myend  (const T (&a)[N]) { return a+N; }

Code Example 5

auto it = max_element(std::begin(cloud), std::end(cloud)); // c++11

Learn ReactJs, React Native from akashmittal.com