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