Изменить 'du5/program.c'

This commit is contained in:
Oleksandr Hryshchenko 2021-04-06 15:07:21 +00:00
parent 8d94d553da
commit 8e6618468d

View File

@ -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;
}
}
}
}