好。。。。。。。。。。Void sortBy Vote(PersonData person[], int lo, int hi){//sort person[lo..hi] in descending order by numVotes int j, k;
PersonData insertItem;
For(j=lo+1; j<=hi; j++) {// process person[lo+1] to person[hi] // insert person j in its proper position
Insert Item = person[j];
K = j-1;
While (k >= lo && insertItem. numVotes.> person[k]. numVotes){person[ k+ 1= person[k];
- -k;
}
Person[k+ 1]= insertItem;
}
} // soreBy vote
Void sortBy Name(PersonData person[], int lo, int hi){
// sort person[lo..hi] in alphabetical order by name
Int j, k;
PersonData insertItem;
For (j = lo+ 1; j<= hi; j++){// process person[lo+ 1] to person[hi]
// insert person j in its proper position
insertItem= person[j];
k= j- 1;
while (k> 0 && strcmp(inserItem. Name, person[k].name) < 0){
person[k+ 1] = person[k];
- -k;
}
Person[k+ 1] = inserItem;
}
} // sortBy Name