From f1b0eb3770373f84fc8f0a32e3f8325a54052728 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 7 Apr 2022 17:02:24 +0200 Subject: [PATCH] ds --- du5/program.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/du5/program.c b/du5/program.c index b7829ad..93f9122 100644 --- a/du5/program.c +++ b/du5/program.c @@ -33,7 +33,7 @@ int main(){ if (value == 0&&line[0]=='\n'){ // Premena sa nepodarila break; - }else if((value==0&&line[0]!='\n'&&size==0)||(size==0&&line==EOF)){ + }else if((value==0&&line[0]!='\n'&&size==0)){ printf("Nepodarilo nacitat nic\n"); return 0; } @@ -56,6 +56,10 @@ int main(){ qsort(databaza, size, sizeof(struct student), compare); } } + if(sizr==0){ + printf("Nepodarilo nacitat nic\n"); + return 0; + } printf("Vysledky:\n"); for(int idx=0;databaza[idx].name[0]!='\0';idx++) printf("%d %s", databaza[idx].votes, databaza[idx].name);