What are you sorting? Is it a vector, string, a char array, is it stored in a file?
Give us something to work with please.
Also at least post a little bit of your own code so we know where you're starting from.
Please, Put this thread into the correct section. There is nothing to do with Windows API nor even included any Windows header files. This should be in beginner section rather than here.
Next the concept of your homework is pretty simple if you write it out on paper before typing code.
You should not be asking for code snippets this early in Programming. I and other members here programmed for almost a decade and we still do not ask for Code. Trust me the logic is pretty straightforward.