Update 'cv5/program.c'
This commit is contained in:
parent
b3a30d7d3c
commit
25eb67de10
@ -43,6 +43,7 @@ int main() {
|
||||
char riadok[150];
|
||||
char meno[MAX_MENO];
|
||||
int pocetHlasov;
|
||||
int validneZaznamy = 0;
|
||||
|
||||
while (fgets(riadok, sizeof(riadok), stdin)) {
|
||||
if (sscanf(riadok, "%d %[^\n]s", &pocetHlasov, meno) == 2) {
|
||||
@ -50,11 +51,19 @@ int main() {
|
||||
printf("Nepodarilo sa pridať hlas.\n");
|
||||
return 1;
|
||||
}
|
||||
validneZaznamy = 1;
|
||||
} else {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!validneZaznamy) {
|
||||
|
||||
printf("Nepodarilo nacitat nic\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
qsort(studenti, pocetStudentov, sizeof(Student), porovnaj);
|
||||
|
||||
printf("Vysledky:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user