max_element c++ stl code example
Example 1: max element in vector c++
auto max = *max_element(vector.begin(), vector.end());
Example 2: c++ max of array
cout << " max element is: " << *max_element(array , array + n) << endl;
Example 3: max_element c++
int arr[] = {1,4,2,10};
int n = 4; //size of array
cout<<*max_element(arr,arr+n);
// Output: 10