HOWTO: How to Sort a CStringArray in MFC (120961)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft C/C++ for MS-DOS 7.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
This article was previously published under Q120961 SUMMARY
You can use the sample code in this article to sort a CStringArray object.
The main() function constructs a CStringArray object, adds elements to it,
prints out the elements, calls the sort() member function to sort it, and
then prints the sorted elements. The sort() function uses the Bubble Sort
algorithm to sort the array and calls the CompareAndSwap() function to
compare each string and swap them if necessary.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbcode kbhowto KB120961 |
---|
|