From 2fcfe5ff2ce0353cd64a12697320c6c32cdd8398 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 16 Apr 2020 14:22:54 +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 2fac10f..e8235ea 100644 --- a/du6/program.c +++ b/du6/program.c @@ -34,25 +34,26 @@ else{ char keep(struct LIS* list,int places){ int count=0; char names[100]; - for(;fgets(names,100,stdin);count++){ + for(;fgets(names,100,stdin);){ if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){ + count++; if(places>=count){ - list[count].num=0; + list[count-1].num=0; } else{ - list[count].num=1; + list[count-1].num=1; } } else if(sscanf(names,"%s",list[count].fname)==1){ + count++; if(places>=count){ - list[count].num=2; + list[count-1].num=2; } else{ - list[count].num=3; + list[count-1].num=3; } } } - count--; return count; } @@ -60,7 +61,7 @@ void sort(struct LIS* list,int count){ struct LIS ilusion; char *min; int mini; - for(int i=0;i