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() { Linklist L; Initlist(&L); Insertlist(&L, 15); Insertlist(&L, 2); Insertlist(&L, 100); Printlist(L); 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; }
main(){ system( "color F1 "); char s1[100],s2[100]; int n=0,i=0; FILE *fp; for(i=0;i<113;i++)a[i]=0; fp=fopen("text.txt","r"); while(fscanf(fp,"%s%s",s1,s2)!=EOF){ Insertlist(s1,s2,n); n++; } fclose(fp); printf("冲突率为:%f\n",float(sum-n)/float(n)); printf("请输入要查找的人名,#表示结束查找:"); scanf("%s",s1); while(strcmp(s1,"#")!=0){ strcpy(s2,"名单里没有这个人,请重新输入!!!"); printf("%d\n%s\n%s\n",search(s1,s2),s1,s2); printf("请输入要查找的人名,#表示结束查找:"); scanf("%s",s1); } }