This commit is contained in:
Filip Chochol 2026-03-10 08:13:27 +01:00
parent 8dce09feb0
commit 72c56a7686

View File

@ -3,8 +3,8 @@
#include <stdlib.h>
#define SIZE 100
struct student {
struct student {
char meno[SIZE];
int hlasy;
@ -25,10 +25,9 @@ int porovnaj(const void* p1, const void* p2) {
struct student* s1 = (struct student*)p1;
struct student* s2 = (struct student*)p2;
if (s2->hlasy > s1->hlasy) return -1;
if (s2->hlasy < s1->hlasy) return 1;
return strcmp(s1->meno, s2->meno);
if (s2->hlasy != s1->hlasy) return s2->hlasy - s1->hlasy;
return strcmp(s1->meno, s2->meno);
}
int main() {
@ -71,7 +70,6 @@ int main() {
if (zaciatok_mena[velkost_mena - 1] == '\n') {
velkost_mena--;
}
if (velkost_mena <= 0) {
continue;
}
@ -106,4 +104,3 @@ int main() {
return 0;
}