From b1b107fb816126d41098108161f6dc911d8a6566 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 16 Apr 2020 15:18:48 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du6/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du6/program.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/du6/program.c b/du6/program.c index e127cb4..b0cfa1b 100644 --- a/du6/program.c +++ b/du6/program.c @@ -35,7 +35,10 @@ char keep(struct LIS* list,int places){ int count=0; char names[100]; for(;fgets(names,100,stdin);){ - if(names[0]=='\n') continue; + if(names[0]=='\n'){ + list[count].num=-1; + continue; + } if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){ count++; if(places>=count){ @@ -83,10 +86,6 @@ void print(struct LIS *list,int count,int places){ if(places>0){ printf("Prijati studenti:\n"); int i=1; - if(count==1){ - i=0; - count--; - } for(i;i<=count;i++){ if(list[i].num==2 && list[i].fname[0]!='\n'){ printf("%s\n",list[i].fname); @@ -111,4 +110,18 @@ void print(struct LIS *list,int count,int places){ else{ puts("Ziadne prihlasky"); } -} \ No newline at end of file +} + + + + + + + + + + + + + + \ No newline at end of file