Оновити 'cv5/program.c'

This commit is contained in:
Kapliuk 2024-03-21 19:20:59 +00:00
parent f5cff7a25b
commit 4aaee3af93

View File

@ -49,7 +49,6 @@ int main(){
int value = strtol(line,&end,10); int value = strtol(line,&end,10);
char* zaciatok_mena = end + 1; char* zaciatok_mena = end + 1;
if (value == 0){ if (value == 0){
printf("Nepodarilo nacitat nic\n");
break; break;
} }
int velkost_mena = strlen(zaciatok_mena) - 1; int velkost_mena = strlen(zaciatok_mena) - 1;
@ -76,7 +75,10 @@ int main(){
counter--; counter--;
qsort(databaza, size, sizeof(struct student), compare_names); qsort(databaza, size, sizeof(struct student), compare_names);
qsort(databaza, size, sizeof(struct student), compare_votes); qsort(databaza, size, sizeof(struct student), compare_votes);
if(databaza[0].votes != 0)
if(databaza[0].votes == 0)
printf("Nepodarilo nacitat nic\n");
else
printf("Vysledky:\n"); printf("Vysledky:\n");
for(int i = 0; i < size; i++) { for(int i = 0; i < size; i++) {
if(databaza[i].votes != 0) if(databaza[i].votes != 0)