diff --git a/cv5/program.c b/cv5/program.c index c25d16a..4cada81 100644 --- a/cv5/program.c +++ b/cv5/program.c @@ -20,22 +20,32 @@ char line[SIZE]; int main() { memset(databaza, 0, SIZE * sizeof(struct student)); + int prvy_vstup = 1; + while (1) { memset(line, 0, SIZE); char *r = fgets(line, SIZE, stdin); if (r == NULL) { - break; + break; } if (strcmp(line, "\n") == 0) { - continue; + continue; } int value = strtol(line, NULL, 10); if (value == 0) { - break; + if (prvy_vstup) { + printf("Nepodarilo nacitat nic.\n"); + return 0; + } else { + break; + } } + + prvy_vstup = 0; + char name[SIZE]; memset(name, 0, SIZE); char *zaciatok_mena = strchr(line, ' ') + 1;