From f736bb989bfd97406be148cab922093d8c6f1ce5 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 9 Apr 2020 12:48:18 +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'du5/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du5/program.c | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/du5/program.c b/du5/program.c index 25d9c59..a71c65d 100644 --- a/du5/program.c +++ b/du5/program.c @@ -13,19 +13,18 @@ int num; int keep(struct LIS *); int del(struct LIS *,int); -void Sort_Struct(struct LIS *,int); +void Sort_Num(struct LIS *,int); +void Sort_Sname(struct LIS *,int); void print(struct LIS *,int); int main(){ struct LIS list[100]; int count=keep(list); -//printf("%d",count); - -//printf("%d",pult); -Sort_Struct(list,count); int pult=del(list,count); -print(list,count); +Sort_Num(list,count); +Sort_Sname(list,count); +print(list,pult); return 0; } @@ -51,9 +50,8 @@ int del(struct LIS *list,int count){ return count; } -void Sort_Struct(struct LIS *list,int count){//bubble sort :) +void Sort_Num(struct LIS *list,int count){//bubble sort :) struct LIS ilusion; - int val; for(int i=0;ii;j--){ if(list[i].numi;j--){ + if(list[i].num==list[j].num && strcmp(list[i].sname,list[j].sname)==0){ + for(int k=0;k