Ok I'm having problems just figuring out how to convert this Sorter
into a string sorter. My main problem is that the strings are inside a structure
So I'm kind of leary on how to sort the name variable from an array of this structure. I also Have to use this sort, it's for a homework assignment so thx for help in advance
Code:
void BubbleSort (int list[], int length) { int temp; int counter; int index; for (counter = 0; counter < length – 1; counter++) { // make one pass through the array for (index = 0; index < length – 1 – counter; index++) // compare side-by-side elements if (list [index] > list [index+1]) { temp = list [index]; list [index] = list [index+1]; list [index+1] = temp; } } // end of outer loop to make one pass through the array }
Code:
struct Census { string name; int cen80; int cen90; };
Comment