Обновить du4/program.c
This commit is contained in:
parent
6296e3b2f4
commit
b84610cbbc
@ -38,8 +38,8 @@ int main() {
|
|||||||
while (fgets(line, SIZE, stdin) != NULL) {
|
while (fgets(line, SIZE, stdin) != NULL) {
|
||||||
char *end = NULL;
|
char *end = NULL;
|
||||||
int votes = strtol(line, &end, 10);
|
int votes = strtol(line, &end, 10);
|
||||||
if (votes == 0) {
|
if (end == line || *end == '\0' || votes <= 0) {
|
||||||
continue; // Neplatný vstup, preskočiť
|
break; // Neplatný vstup, ukončiť načítanie
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preskočiť medzeru po čísle hlasov
|
// Preskočiť medzeru po čísle hlasov
|
||||||
|
Loading…
Reference in New Issue
Block a user