Horje
max of a vector c++ Code Example
max element in vector c++
auto max = *max_element(vector.begin(), vector.end());
max of a vector c++
cout<<*max_element(a.begin(), a.end())<<endl;
c++ max and min of vector
#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';
}
c++ max and min of vector
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; }
c++ max and min of vector
auto it = max_element(std::begin(cloud), std::end(cloud)); // c++11




Cpp

Related
get thread id c++ Code Example get thread id c++ Code Example
change integer to string c++ Code Example change integer to string c++ Code Example
convert decimal to binary c++ Code Example convert decimal to binary c++ Code Example
initialize 2D vector Code Example initialize 2D vector Code Example
vector to string c++ Code Example vector to string c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7