Изменить 'du5/program.c'
This commit is contained in:
parent
8d94d553da
commit
8e6618468d
@ -31,6 +31,7 @@ bool addPoints(struct entry* myEntries, int votes, char* name){
|
||||
void bsortDesc(struct entry* list[80], int s){
|
||||
int i, j;
|
||||
struct entry* temp;
|
||||
int count = 0;
|
||||
|
||||
for (i = 0; i < s - 1; i++)
|
||||
{
|
||||
@ -42,10 +43,14 @@ void bsortDesc(struct entry* list[80], int s){
|
||||
list[j] = list[j + 1];
|
||||
list[j + 1] = temp;
|
||||
}
|
||||
else if ((list[j]->votes == list[j + 1]->votes) && (list[j]->name[0] > list[j + 1]->name[0])){
|
||||
temp = list[j];
|
||||
list[j] = list[j + 1];
|
||||
list[j + 1] = temp;
|
||||
else if (list[j]->votes == list[j + 1]->votes){
|
||||
while (list[j]->name[count] == list[j + 1]->name[count])
|
||||
count++;
|
||||
if (list[j]->name[0] > list[j + 1]->name[0]){
|
||||
temp = list[j];
|
||||
list[j] = list[j + 1];
|
||||
list[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user