I'm really stuck in this one. For my function I need to find the highest, 2nd highest, 3rd highest and lowest from a vector with 4 ints. Am I missing something and is this actually really easy? I tried yet with the max() function etc but no succes...
Please do give the code, but just the concept so I can work it out myself..
take the maximum of (A, B) and call it Max(ab);
take the minimum of (A, B) and call it Min(ab);
take the maximum of (C, D) and call it Max(cd);
take the minimum of (C, D) and call it Min(cd);
Now
the maximum of ( Max(ab), Max(cd) ) is the highest number of the four;
the minimum of ( Min(ab), Min(cd) ) is the lowest number of the four;
the two numbers left (minimum of Max(ab) and maximum of Min(cd))
are the 2nd and 3rd highest, in some order.