Aktualizovat „du5/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-04-09 23:18:30 +00:00
parent 1dbd46afb2
commit ca4f70c993

View File

@ -65,7 +65,7 @@ int main(){
} }
int flag=0; //int flag=0;
qsort(PersonList,c,sizeof(struct person),comp_num); qsort(PersonList,c,sizeof(struct person),comp_num);
int k =0; int k =0;
@ -76,21 +76,17 @@ int main(){
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;
k++; c--;
flag=1; for (int k=i; k<30; k++){
PersonList[k] = PersonList[k];
}
} }
} }
} }
if(flag==1){
k--;
}
else{
k=c;
}
printf("Vysledky:\n"); printf("Vysledky:\n");
for(int i =0;i<k;i++){ for(int i =0;i<c;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;