c++ has built in sorting, but usually these problems are to re-invent the wheel and learn how to do it yourself. There are a bunch of nifty sorting algorithms out there, my favorite personally is shellshort which is just a handful of lines of code yet performs as well as anything else up to many millions of entries, it is slowly passed by more complex algorithms if dealing with big data, but if you had big data, .. use the built in one :) I advise you to research it, as it has a very unique profile ... its computational complexity varies based off which sequence you choose to use for the presorting. I think the top end is O(N ^((c+1)/c) ) where C can vary but is generally less than 10. Its a fun study.
You can find code for it, or pseudo code, online easily. Give it a try, and ask if you get stuck trying to make it work.
Once you get it working for A) figure out the logic to reverse the comparison and swap logic for B). C and D make use of sorted data, so those can wait.