diff --git a/du5/program.c b/du5/program.c index b241bb5..1d0237b 100644 --- a/du5/program.c +++ b/du5/program.c @@ -24,6 +24,12 @@ int comp(const void *p1, const void *p2){ return strcmp(person1->name, person2->name); } +int comp_num(const void *p1, const void *p2){ + struct person* person1 = (struct person*)p1; + struct person* person2 = (struct person*)p2; + + return person1->scorescore; +} int main(){ @@ -59,8 +65,8 @@ int main(){ } int flag=0; - - printf("Vysledky:\n"); + qsort(PersonList,c,sizeof(struct person),comp_num); + printf("Vysledok\n"); for(int i =0;i