Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Find minimum maximum element CPP

// minmax_element
#include <iostream>     // std::cout
#include <algorithm>    // std::minmax_element
#include <array>        // std::array

int main () {
  std::array<int,7> foo {3,7,2,9,5,8,6};

  auto result = std::minmax_element (foo.begin(),foo.end());

  // print result:
  std::cout << "min is " << *result.first;
  std::cout << ", at position " << (result.first-foo.begin()) << '
';
  std::cout << "max is " << *result.second;
  std::cout << ", at position " << (result.second-foo.begin()) << '
';

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: integer to char c++ 
Cpp :: C++ fill string with random uppercase letters 
Cpp :: how to empty string c++ 
Cpp :: a square plus b square plus c square 
Cpp :: string search c++ 
Cpp :: convert characters to lowercase c++ 
Cpp :: find element in vector 
Cpp :: how to initialize vector 
Cpp :: how to make Dijkstra in c++ 
Cpp :: Inner Section Sticky Scroll in elementor 
Cpp :: c++ program to convert kelvin to fahrenheit 
Cpp :: print counting in c++ 
Cpp :: how to print in new lines in C++ 
Cpp :: Visual studio code include path not working c++ 
Cpp :: cpp ifdef 
Cpp :: c++ syntax 
Cpp :: c++ check if debug or release visual studio 
Cpp :: visual studio getline not working 
Cpp :: c ++ split_string 
Cpp :: c++ constructor call superclass 
Cpp :: take a function as an argument in c++ 
Cpp :: print hola mundo 
Cpp :: sum of first 100 natural numbers 
Cpp :: Initialize Vector Iterator 
Cpp :: c++ polymorphism 
Cpp :: c++ garbage collection 
Cpp :: bit++ codeforces in c++ 
Cpp :: tabeau dynamique c++ 
Cpp :: c++ map 
Cpp :: find factorial in c++ using class 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =