Maximum & minimum in c++ | Sololearn: Learn to code for FREE!


Maximum & minimum in c++

Can anyone help to find maximum and minimum between 4numbers in c++, with just using if/else? It goes like this: user enters 4 numbers and I have to give the user maximum and minimum numbers back. I appreciate it :))


3/7/2021 1:54:58 PM


9 Answers

New Answer


+5 if you use a container, like vector, you can use this stl library function


Martin Taylor seems to work with runtime values too

+3 hope this helps


Then even more simple is to shove an initializer list to std:: min or max


#define CPP ChillPill Martin Taylor Sharique Khan thank you so much!