std::minmax() and std::minmax_element() in C++ STL
We are already aware that the C++ programming language has a Standard Template Library which is vast like an ocean and has many pre-defined functionalities. To get the answer of which among the array elements passed either as an input by the user or pre-defined by the testers/developers is maximum or minimum amongst them, we use the standard minimum function or the entire function.
It might get a little overwriting or using the code, again and again, to know both values at a time. So C++ STL has a solution for us in the form of std minmax() and minmax_element functions. Both functions accept parameters in the form either variables, which are of any natural numbers, integers and also an array of elements.
C++ Code for minmax() Function
/ tmp / 1Lj mBg VyK h.o The minimum value is : 33 The maximum value is : 63 minimum value : 11 maximum value : 16
C++ Code for minmax_element() Function
/ tmp /1 LjmB gVy Kh.o position of the minimum value obtained after operating is : 7 position of the maximum value received after working is : 10 position of the minimum value obtained after operating is : 1 position of the maximum value received after working is : 5
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week