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

This commit is contained in:
Pavlo Tverdyi 2020-04-09 18:47:23 +00:00
parent 7b1cb9cf67
commit 12ee512ade

View File

@ -40,17 +40,17 @@ int keep(struct LIS *list){
int del(struct LIS *list,int count){ int del(struct LIS *list,int count){
int kount=count; int kount=count;
for(int i=0;i<count;i++){ for(int i=0;i<count-1;i++){
for(int j=count;j>0;j--){ for(int j=i+1;j<count;j++){
if(strcmp(list[i].fname,list[j].fname)==0 && strcmp(list[i].sname,list[j].sname)==0 && list[j].num!=-1) { if(strcmp(list[i].fname,list[j].fname)==0 && strcmp(list[i].sname,list[j].sname)==0 && list[j].num!=-1) {
kount--; kount--;
list[i].num+=list[j].num; list[i].num+=list[j].num;
list[j].num=-1; list[j].num=-1;
printf("\n%d %s %s\n",list[i].num, list[i].sname, list[i].fname);
} }
} }
} }
return count; return kount;
} }
void Sort_Num(struct LIS *list,int count){//bubble sort :) void Sort_Num(struct LIS *list,int count){//bubble sort :)
@ -65,7 +65,6 @@ void Sort_Num(struct LIS *list,int count){//bubble sort :)
} }
} }
} }
void Sort_Sname(struct LIS *list,int count){//Selection Sort void Sort_Sname(struct LIS *list,int count){//Selection Sort
struct LIS ilusion; struct LIS ilusion;
char *min; char *min;