From 0e205349ecf330186a828420118295bf8ab47de4 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 7 Apr 2022 16:53:51 +0200 Subject: [PATCH] ds --- du5/program.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/du5/program.c b/du5/program.c index 83567bf..91e6151 100644 --- a/du5/program.c +++ b/du5/program.c @@ -20,20 +20,23 @@ int main(){ int size = 0; while(1){ - char line[SIZE]; - memset(line,0,SIZE); - char* r = fgets(line,SIZE,stdin); - if (r == NULL){ + char line[SIZE]; + memset(line,0,SIZE); + char* r = fgets(line,SIZE,stdin); + if (r == NULL){ // Nastal koniec načítania break; } char* end = NULL; int value = strtol(line,&end,10); - if (value == 0){ + if (value == 0&&line[0]=='\n'){ // Premena sa nepodarila break; - } + }else if(value==0&&line[0]!='\n'){ + printf("Nepodarilo nacitat nic\n"); + return 0; + } char *name=end+1; int id = find_student(databaza,size,name);