You can't use RTL functions like qsort so you will have to write your own. For a very small set of data a bubble sort will work adequately. You will also have to write your own swap routine and those are usually fairly simple. Typically, a bubble sort is something like this :
int count = collection.size();
for( int m = 0; m < count-1; ++m )
{
for( int n = m + 1; n < count; ++n )
{
if( collection[m] > collection[n] )
{
collection.swap( m, n );
}
}
}
Here's an example of swapping :
temp = a;
a = b;
b = temp;
In this case, a and b were the two items being checked in the bubble sort.
Your task will be to translate this pseudo code into real code. I won't do that for you because you will learn nothing from that. Hopefully, you can learn something in the process of writing real code for this algorithm. For example, the pseudo code shows a comparison of two items in the collection so how would you perform that comparison if you want to sort on the basis of the text? The answer is use to a comparison method of the CString class. I will let you figure that out too.
Remember, the debugger is your friend so if you run into troubles use it to help you figure out what is going on. I still use it daily so it is a good idea to become very familiar with it.
One tip: you can switch the order of the sort by changing the comparison from greater than to less than. You should try both to verify your implementation if you have the time. Best of luck.