Изменить 'du5/program.c'
This commit is contained in:
parent
1a0cf13d16
commit
76b3ecbbd5
@ -21,31 +21,18 @@ int main(){
|
||||
struct LIS list[100];
|
||||
int count=keep(list);
|
||||
//printf("%d",count);
|
||||
int pult=del(list,count);
|
||||
|
||||
//printf("%d",pult);
|
||||
Sort_Struct(list,count);
|
||||
int pult=del(list,count);
|
||||
print(list,count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int keep(struct LIS *list){
|
||||
char *array;
|
||||
int stop,count;
|
||||
int num;
|
||||
for(int i=0; stop!=EOF; i++){
|
||||
array=(char*)malloc(100);
|
||||
stop =0;
|
||||
for(int j=0;stop!='\n';j++){
|
||||
stop=getchar();
|
||||
if(stop==EOF) break;
|
||||
if(stop!='\n'){
|
||||
array[j]=stop;
|
||||
}
|
||||
}
|
||||
if(stop==EOF) break;
|
||||
sscanf(array,"%d %s %s",&list[i].num,list[i].sname,list[i].fname);
|
||||
count++;
|
||||
free(array);
|
||||
int count;
|
||||
for(count=0;fscanf(stdin,"%d %s %s",&list[count].num, list[count].sname, list[count].fname)==3;count++){
|
||||
for(int i=0;list[count].fname[i]!='\0';i++);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -84,7 +71,6 @@ void Sort_Struct(struct LIS *list,int count){//bubble sort :)
|
||||
for(int k=0;k<val;k++){
|
||||
if(list[i].sname<list[j].sname && list[j].num!=-1 && list[i].num!=-1){
|
||||
ilusion=list[i];
|
||||
free(list[i].sname);
|
||||
list[i]=list[j];
|
||||
list[j]=ilusion;
|
||||
}
|
||||
@ -100,7 +86,6 @@ void Sort_Struct(struct LIS *list,int count){//bubble sort :)
|
||||
for(int l=0;l<val;l++){
|
||||
if(list[i].fname<list[j].fname && list[j].num!=-1 && list[i].num!=-1){
|
||||
ilusion=list[i];
|
||||
free(list[i].fname);
|
||||
list[i]=list[j];
|
||||
list[j]=ilusion;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user