Horje
c++ max and min of vector Code Example
max element in vector c++
auto max = *max_element(vector.begin(), vector.end());
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
declare vector of size n in c++ Code Example declare vector of size n in c++ Code Example
pause the console c++ Code Example pause the console c++ Code Example
uses of gamma rays Code Example uses of gamma rays Code Example
c++ define vector with size Code Example c++ define vector with size Code Example
ex:c programming Code Example ex:c programming Code Example

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