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