Can someone help me with sorting lastnames alphabetically?
Can someone help me with sorting lastnames alphabetically?
I'm sure someone can.
But for starters, why don't you do some sorting research online? Or come up with an algorithm and ask us how you can improve it?
To help you save time, look up: heap sort, bubble sort, quicksort.
Those sorts messes up the index ( sLastname[index] ) I need the original index to display the information about that peson.
You want to sort objects, not strings. The information moves along with the object.
I posted a complete example code the last time you asked this question (http://cboard.cprogramming.com/showt...threadid=40407). That code will take objects of a certain type and sort them, using the builtin C++ vector and sorting algorithms.
You can have multiple arrays that are connected. For example, say you have two sorting criteria, then you could have the following:
When you create each instance of c1 and c2, you give it a pointer to a data object (which are stored in their own array). The values for c1 and c2 are also stored in their own separate arrays, but even after being sorted, they still point to the same data.Code:class data { // Whatever ... }; struct c1 { int value; data* ptr; }; struct c2 { int value; data* ptr; };
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.