From ba05a39537bcbb0ea84d5eff1040ef92270cece5 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Wed, 13 Mar 2024 12:22:37 +0100 Subject: [PATCH] mozno 100 --- cv5/program.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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;