int main(){ Sqlist La,Lb,Lc; int i=1; ElemType num = 0; Initlist(&La); Initlist(&Lb); printf("plsase input LIST A,-1 to end\n"); while(1){ scanf("%d",&num); if(num == -1) break; Insertlist(&La,i,num); i++; } Showlist(&La); i = 1; printf("please input LIST B,-1 to end\n"); while(1){ scanf("%d",&num); if(num == -1) break; Insertlist(&Lb,i,num); i++; } Showlist(&Lb); Mergelist(La,Lb,&Lc); printf("MERGE DONE!\n"); Showlist(&Lc); return 0; }
int main(){ Sqlist La,Lb,Lc; int i=1; // ElemType num = 0; ElemType num = '0'; //if it misunderstand you,rename it char Initlist(&La); Initlist(&Lb); printf("plsase input LIST A,q to end\n"); while(1){ scanf("%c",&num); if(num == 'q' ||num =='Q') break; Insertlist(&La,i,num); i++; } // Sortlist(&La); Showlist(&La); i = 1; printf("please input LIST B,q to end\n"); while(1){ // scanf("%d",&num); scanf("%c",&num); if(num == 'q' ||num =='Q') break; Insertlist(&Lb,i,num); i++; } // Sortlist(&Lb); Showlist(&Lb); /* printf("IS THERE any element you want to delete from list b,enter the positon,0 means no action\n"); int n; scanf("%d",&n); if(n=0) return 0; else Deletelist(&Lb,n); Showlist(&Lb); */ Mergelist(La,Lb,&Lc); // printf("MERGE DONE!\n"); // Showlist(&Lc); return 0; }
int main() { Linklist L; Initlist(&L); Insertlist(&L, 15); Insertlist(&L, 2); Insertlist(&L, 100); Printlist(L); return 0; }
int main(){ struct Seqlist s; int i=0,k; Initlist(&s); printf("input data: "); do{ scanf("%d",&k); if(k==0) break; InsertList(&s,k,i); printf("%d ",s.data[i++]); }while(1); printf("\n"); printf("delete element: \n"); scanf("%d",&k); DeleteList(&s,k); printf("output sequeue list: \n"); for(i=0;i<ListSize-1;i++){ printf("%d ",s.data[i]); } }