Hi,
I'm kind of embarassed to be asking this since I should be able to figure this out by now, but I'm writing a program to sort a vector of objects alphabetically by a string member variable.
Can someone help me figure out why the bubble sort below won't work? The whole thing compiles fine but outputs the data unsorted.
for(int y = 0; y < 49; y++){
for(int x = 0; x < 49; x++){
tResult= strcmp(deansList[x].lastName.c_str(), deansList[x+1].lastName.c_str());
if(tResult > 0){
swapper = deansList[x];
deansList[x] = deansList[x+1];
deansList[x+1] = swapper;
}//if
}//loop
}//outer loop
Thanks a lot.