Hey, I've been trying to figure out a way to arrange 3 user-inputted numbers in order from greatest to least, but so far have been unable to do so. Is there a simple and efficient way to get this done?
Yes, use a 2x std::min call, a 2x std::max call, and then take the sum of the three numbers, but then subtract the minimum and maximum. You're left with the number that's neither the minimum or maximum -- the median. In general, use Median of medians for the middle element (you can simplify it a ton by knowing there's only 3 values instead of N values).
and similar for smallest.
you can combine the statements to exploit things you know -- you know that if second > biggest then second is not smallest. If third > biggest, third is not smallest. The logic to exploit that is less intuitive than the naive approach and you have to be careful to get it right (that is why I said do the simple one and get that right first). All the extra twisting of the code saves like 1 comparison; its good to know you can do it and how to do it, but it isnt necessary here.