From 73006062d7965a8ae7979f6bb08b98a19c011de0 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 16 Apr 2020 19:22:15 +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 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/du6/program.c b/du6/program.c index f66c470..65b50d6 100644 --- a/du6/program.c +++ b/du6/program.c @@ -33,13 +33,14 @@ else{ char keep(struct LIS* list,int places){ int count=0; char names[100]; - for(;fgets(list[count].fname,100,stdin);count++){ + for(;fgets(list[count].fname,100,stdin);){ if(list[count].fname[0]=='\n'){ list[count].num=-1; // printf("skip"); } if(list[count].fname[0]!='\n'){ - list[count].num=0; + list[count].num=0; + count++; } } return count; @@ -71,20 +72,20 @@ void print(struct LIS *list,int count,int places){ if(count>0){ if(places>0){ int k=0; - puts("Prijati studenti:"); + printf("Prijati studenti:\n"); for(int i=0;k!=places+1;i++){ if(list[i].num==0){ - puts(list[i].fname); + fputs(list[i].fname,stdout); k++; } } } if(count-places>0){ int k=0; - puts("Neprijati studenti:"); - for(int i=places+1;i