From 38407413992369fca05a1175ed52695ae63d6a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Kave=C4=8Dansk=C3=BD?= Date: Fri, 29 Mar 2019 11:54:29 +0100 Subject: [PATCH] 1 --- anketa.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 anketa.c diff --git a/anketa.c b/anketa.c new file mode 100644 index 0000000..2ea5d4e --- /dev/null +++ b/anketa.c @@ -0,0 +1,78 @@ +#include "anketa.h" +#include +#include +#include + +int count_students(struct student* students){ + int i; + for(i=0; ivotes==stud2->votes){ + return 0; + }else if(stud1->votesvotes){ + return 1; + } + return -1; +} + +void sort_students(struct student* students){ + qsort(students,count_students(students),sizeof(struct student),compare); +} + +void print_students(struct student* students){ + for(int i=0;i