From 46d0348629d8ec5f9e797901515aa6d0b20b6901 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 9 Apr 2020 17:50:32 +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 | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/du5/program.c b/du5/program.c index 66e6767..0e5ca9d 100644 --- a/du5/program.c +++ b/du5/program.c @@ -15,7 +15,7 @@ int keep(struct LIS *); int del(struct LIS *,int); void Sort_Num(struct LIS *,int); void Sort_Sname(struct LIS *,int); -void Sort_Fname(struct LIS *,int); +//void Sort_Fname(struct LIS *,int); void print(struct LIS *,int); @@ -25,7 +25,7 @@ int count=keep(list); int pult=del(list,count); Sort_Num(list,count); Sort_Sname(list,count); -Sort_Fname(list,count); +//Sort_Fname(list,count); print(list,pult); return 0; } @@ -64,31 +64,27 @@ void Sort_Num(struct LIS *list,int count){//bubble sort :) } } } -void Sort_Sname(struct LIS *list,int count){ + +void Sort_Sname(struct LIS *list,int count){//Selection Sort struct LIS ilusion; - for(int i=count-1;i<0;i--){ - for(int j=0;j0) { - ilusion=list[j]; - list[j]=list[j+1]; - list[j+1]=ilusion; - } + char *min; + int mini; + for(int i=0;i0){ + min=list[j].sname; + mini=j; + } } + ilusion=list[i]; + list[i]=list[mini]; + list[mini]=ilusion; } } + void print(struct LIS *list,int pult){ printf("Vysledky:\n"); for(int i=0;i