Изменить 'du5/program.c'

This commit is contained in:
Pavlo Tverdyi 2020-04-08 21:28:42 +00:00
parent 566680fe06
commit 1379e394cb

View File

@ -63,8 +63,7 @@ int del(struct LIS *list,int count){
return count; return count;
} }
void Sort_Struct(struct LIS *list,int count){ void Sort_Struct(struct LIS *list,int count){//bubble sort :)
struct LIS ilusion; struct LIS ilusion;
for(int i=0;i<count;i++){ for(int i=0;i<count;i++){
for(int j=count;j>i;j--){ for(int j=count;j>i;j--){
@ -73,6 +72,24 @@ void Sort_Struct(struct LIS *list,int count){
list[i]=list[j]; list[i]=list[j];
list[j]=ilusion; list[j]=ilusion;
} }
if(list[i].num==list[j].num){
for(int k=0;k<strlen(list[i].sname);k++){
if(list[i].sname<list[j].sname){
ilusion=list[i];
list[i]=list[j];
list[j]=ilusion;
}
}
}
if(list[i].num==list[j].num && list[i].sname==list[j].sname){
for(int l=0;l<strlen(list[i].fname);l++){
if(list[i].fname<list[j].fname){
ilusion=list[i];
list[i]=list[j];
list[j]=ilusion;
}
}
}
} }
} }
} }