From b6c2b8eee8626425c697c2fd03ee294bceab269d Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 9 Apr 2020 20:29:40 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu5/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du5/program.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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