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

This commit is contained in:
Kapliuk 2024-03-21 19:18:43 +00:00
parent ad49fccc76
commit f5cff7a25b

View File

@ -50,7 +50,7 @@ int main(){
char* zaciatok_mena = end + 1; char* zaciatok_mena = end + 1;
if (value == 0){ if (value == 0){
printf("Nepodarilo nacitat nic\n"); printf("Nepodarilo nacitat nic\n");
return 0; break;
} }
int velkost_mena = strlen(zaciatok_mena) - 1; int velkost_mena = strlen(zaciatok_mena) - 1;
if (velkost_mena > 0){ if (velkost_mena > 0){
@ -76,7 +76,8 @@ 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);
printf("Vysledky:\n"); if(databaza[0].votes != 0)
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)
printf("%d %s\n", databaza[i].votes, databaza[i].name); printf("%d %s\n", databaza[i].votes, databaza[i].name);