From d5596e0aa6f5fcb19009ae91f8e371d9a44da43e Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 16 Apr 2020 16:08:10 +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, 6 insertions(+), 9 deletions(-) diff --git a/du6/program.c b/du6/program.c index cea8958..baca34b 100644 --- a/du6/program.c +++ b/du6/program.c @@ -66,6 +66,12 @@ void sort(struct LIS* list,int count){ char *min; int mini; for(int i=0;i<=count-1;i++){ + if(strcmp(list[i].fname,list[i+1].fname)==0 && strcmp(list[i].name,list[i+1].name)>0){ + ilusion=list[i]; + list[i]=list[i+1]; + list[i+1]=ilusion; + i++; + } min=list[i].fname; mini=i; for(int j=i+1;j<=count;j++){ @@ -78,15 +84,6 @@ void sort(struct LIS* list,int count){ list[i]=list[mini]; list[mini]=ilusion; } - for(int i=0;i<=count-1;i++){ - for(int j=1;j<=count;j++){ - if(strcmp(list[i].fname,list[j].fname)==0 && strcmp(list[i].name,list[j].name)>0){ - ilusion=list[i]; - list[i]=list[j]; - list[j]=ilusion; - } - } - } } void print(struct LIS *list,int count,int places){