Aktualizovat „du5/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-04-09 23:04:11 +00:00
parent 5be95e0e42
commit 13b4d317b3

View File

@ -72,19 +72,19 @@ int main(){
for(int i =0;i<c-1;i++){ for(int i =0;i<c-1;i++){
for(int j=i+1;j<c-1-i;j++){ for(int j=i+1;j<c-1-i;j++){
if(strcmp(PersonList[i].name,PersonList[j].name)==0&&PersonList[i].score>PersonList[j].score){ if(strcmp(PersonList[i].name,PersonList[j].name)==0){
struct person temp = PersonList[j]; struct person temp = PersonList[j];
PersonList[j] = PersonList[j+1]; PersonList[j] = PersonList[j+1];
PersonList[j+1]=temp; PersonList[j+1]=temp;
c--; k++;
} }
} }
} }
k--;
printf("Vysledky:\n"); printf("Vysledky:\n");
for(int i =0;i<c;i++){ for(int i =0;i<k;i++){
printf("%d %s\n",PersonList[i].score,PersonList[i].name); printf("%d %s\n",PersonList[i].score,PersonList[i].name);
} }
return 0; return 0;