From c9a74987d04550420fcf2a53e582098b11620094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michaela=20=C5=A0akov=C3=A1?= Date: Mon, 25 Mar 2019 15:37:46 +0100 Subject: [PATCH] test --- anketa | Bin 12747 -> 12735 bytes anketa.c | 9 +++++++-- anketa.o | Bin 6860 -> 6848 bytes main.c | 3 ++- main.o | Bin 5916 -> 5936 bytes vstup.txt | 7 ++++++- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/anketa b/anketa index 7742f1a2925e53566ebfae1f9a3ac366ee930bfd..2f218f7b1302cee3ca6958b41071a765d3dc2a98 100755 GIT binary patch delta 593 zcmX?|ygzw@0;9%8#c)QE6#m$S3mo^m5M;I+); z-)u6Q<=7h-8OeumAsF2lu+DNOZEOyg2X|$a9798h|_)dl^VZ8^%lf2jt1Zcwd0#cDksrfXoEh zlL0hy0@z_E4{v_Jd4SP&T_+32O*H(kgN0)cnix#Y6rgw;Om6dC?$wO^1&ly1Ir4F| zGCA?GGUsfb&byJ3@xW$J{y8jK7K{q*EF3{V`~awkaWe}8gWxU@%OaPVfq`iv1A{o@ zAE16lo5}nl66!WkQIQCsj*UPpl*zzo8wJ$BG%*LHb}LA)%Va+h32T>7RW^IRZ0 zSwuBJDqLlOrZZ3Ms26<<;<|xMV4m1gFDeS=PF^UY!}b8^3pK{g<^0E(CeIX~%lKfj zxr7(v&CN{`^-SzaKsPZlteb2tlRddux}EiN>F2V@$viR|j6Wxv%DmmID7%=2cRyHB zDF=u?u=%2*KO3X+WJL{SMwQ8~8tRO9Cg*CXvtChTU1_Zc$)aG}Cd delta 622 zcmdm=d^&l80;9=B#c)QEq`mE{tsZ`w#P9l}PV3;*?Xx`&Y}(wzn9HhKBG>Kur#m2} z+x17cLyG00TJ{}`3=9mfS$F&g0w4wCFl?4%Z(wB9o;;r;Ncskl-_6pxpqqu`|AXT! zDji)c952#-|NsAT-(()n?95Q0SOZY<#hYJ1{qDUkDiWP6DlZQF1@bImyao_Y8^$a8 z2jt1Zcnp93|L=5BVF8%~GP?w5&IGVCP9C0s1U5h5JiutXsFQ``EE@jT!NRctO$?@H z3Q)WaCb#)6_i9G|6p)7<`8ZmcoOoH86E;uh-N?weWwR&$92PBOMum13jvyd@093@d znT3Hta2JSWoXgC>z%-G8L7edqP(P#jWPT9|b#thwNCZ&FMj#f-WMH(20%~BIm;+L~ z6{OdGvY&{AwS6cn*aV1q_7I&cq8cC-4zfVgnJ0GCi#`T%9YH2APi(0d6$NuAFBH*X zy8`ruG2`ZP{$os&XNu2dyfWEb!i(|j<|c`HCU$+Go0u5ZP1cjio?I;5F2umZ!pQas zNHTGx0ZC@I-IM=IYcT$ptReGuvzY867T(QZ9iJ(n{R6TXJJg)d{g%sGXRV3%{c%7 diff --git a/anketa.c b/anketa.c index 3acc53c..2ea5d4e 100644 --- a/anketa.c +++ b/anketa.c @@ -45,11 +45,16 @@ int add_student(struct student* students, const char* name, int votes){ int compare(const void* s1,const void* s2){ struct student* stud1=(struct student*)s1; struct student* stud2=(struct student*)s2; - return stud1->votes==stud2->votes?0:stud1->votesvotes?1:-1; + if(stud1->votes==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); + qsort(students,count_students(students),sizeof(struct student),compare); } void print_students(struct student* students){ diff --git a/anketa.o b/anketa.o index 34078712d0923a099f78caf4098552e724b81c78..2ee2956ae825906d4801dbe4f0e201492ac3c111 100644 GIT binary patch delta 313 zcmX?Odcbso0^^m9iUEwOrR+NxfZ(-Ex9gwofRt|6AKeZqmWOKDcQAs4S$F&gg3Z$y z7qV(uFs1;-rUCH-pcLa~76t~vjUbjqE;9oI(?kXaamElPAm3(kBD;jT4OCQQ4p7He zAQsAGV6=?_YG9g}15$eoq}OHg0(J>&mrz!)2@vyKAUat@H9#s{Wr3zMPwc1{{R`r{ zflOeY*itVl3g&M9%>IjsQEBo!t{<$QOFx%IZvMe-!Ms_YUyzBhVX~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