minmax_element c++
C++
// 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()) << '\n';
std::cout << "max is " << *result.second;
std::cout << ", at position " << (result.second-foo.begin()) << '\n';
return 0;
}
Also in C++:
- Title
- variadic templates
- Category
- C++
- Title
- system("pause") note working c++
- Category
- C++
- Title
- stringstream in c++
- Category
- C++
- Title
- convert decimal to binary in c++
- Category
- C++
- Title
- convert stirng to int c++
- Category
- C++
- Title
- inconsequential meaning
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- how to initialize a vector in c++
- Category
- C++
- Title
- c++ ros publisher
- Category
- C++
- Title
- c++ raw string
- Category
- C++
- Title
- how to use assrt c++
- Category
- C++
- Title
- declare vectors c++
- Category
- C++
- Title
- how to avoid tle in c++
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- file reading c++
- Category
- C++
- Title
- length of string c++
- Category
- C++
- Title
- dijkstra in c++
- Category
- C++
- Title
- c++ program for addition of two numbers using functions
- Category
- C++
- Title
- c++ calculator program using switch case
- Category
- C++
- Title
- c++ find prime numbers
- Category
- C++
- Title
- c++ class template
- Category
- C++
- Title
- c++ try
- Category
- C++
- Title
- error: redefinition of ‘class Customer’
- Category
- C++
- Title
- runtime array size c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- constant variables in c++
- Category
- C++
- Title
- count a character in a string c++
- Category
- C++
- Title
- cut by delimiter c++
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- trovare il valore massimo in un array c++ w3
- Category
- C++
- Title
- namespace c++
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- c++ for loop
- Category
- C++
- Title
- lopping over an array c++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- write to file in C++
- Category
- C++
- Title
- how to remove maximum number of characters in c++ cin,ignore
- Category
- C++
- Title
- log base 10 c+_+
- Category
- C++
- Title
- iterate 2d array c++
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- ios_base::sync_with_stdio(false);cin.tie(NULL);
- Category
- C++
- Title
- COnvert string to char * C++
- Category
- C++
- Title
- c++ excel blank cells
- Category
- C++
- Title
- print matrix c++
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- set c++
- Category
- C++
- Title
- clear qlayout
- Category
- C++
- Title
- range of long long in c++
- Category
- C++
- Title
- c++ excel cell blank cells
- Category
- C++
- Title
- Newton's sqrt in c++
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- C++ w3schools
- Category
- C++
- Title
- if vector contains value c++
- Category
- C++
- Title
- array syntax in c++
- Category
- C++
- Title
- map vs unordered_map in C++
- Category
- C++
- Title
- char size length c++
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- new class * [] c++
- Category
- C++
- Title
- binary search stl in c++
- Category
- C++
- Title
- is TLE means my code is correct but taking more time to computr
- Category
- C++
- Title
- maximum subarray sum equal with K in c++
- Category
- C++
- Title
- vector concat c++
- Category
- C++
- Title
- convert GLFWwindow* to IntPtr
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- single line if c++
- Category
- C++
- Title
- unordered_map c++ insert
- Category
- C++
- Title
- How to check if a triangular cycle exists in a graph
- Category
- C++
- Title
- tuple c++
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- built in function in c++ for binary to decimal
- Category
- C++
- Title
- recursion in cpp with reference
- Category
- C++
- Title
- print type cpp
- Category
- C++
- Title
- c++ convert int to double
- Category
- C++
- Title
- c++ string contains
- Category
- C++
- Title
- c++ declare variable
- Category
- C++
- Title
- c++ push multiple elements to vector
- Category
- C++
- Title
- jump to case label c++
- Category
- C++
- Title
- peak in c++
- Category
- C++
- Title
- pause the console c++
- Category
- C++
- Title
- C++ while
- Category
- C++
- Title
- c++ crash windows
- Category
- C++
- Title
- namespaces c++
- Category
- C++
- Title
- sqrt cpp
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- function declerations in C++
- Category
- C++
- Title
- static variable in c++
- Category
- C++
- Title
- accumulate in cpp
- Category
- C++
- Title
- how to measure program run time in c++
- Category
- C++
- Title
- primeros numeros primos
- Category
- C++
- Title
- call by reference c++ example
- Category
- C++
- Title
- calling by reference c++
- Category
- C++
- Title
- random number generator c++
- Category
- C++
- Title
- Html tab
- Category
- C++
- Title
- c++ typedef
- Category
- C++
- Title
- initialize map c++
- Category
- C++