2、lloc.h>#defineLENsizeof(structstudent)#defineNULL0structstudent{longnum;charname[20];charjg[20];structstudent*next;};intn=0;voidsave(structstudent*head){FILE*fp;charfilename[20];structstudent*p1;printf("Pleaseinputthefilename");scanf("%s",filename);if((fp=fopen(filename,"w"
3、))==NULL){printf("can'topenfile");return;}for(p1=head;p1!=NULL;p1=p1->next){fprintf(fp,"%ld",p1->num);fputc('t',fp);fprintf(fp,"%s",p1->name);fputc('t',fp);fputc('t',fp);fprintf(fp,"%s",p1->jg);fputc('',fp);}free(p1);fclose(fp);}voidprint(structstudent*head){structstud
4、ent*p;printf("Now,theseinformationis:");p=head;if(head!=NULL)do{printf("%ldt%stt%s",p->num,p->name,p->jg);p=p->next;}while(p!=NULL);}structstudent*creat(){structstudent*head,*p1,*p2;charch;p1=p2=(structstudent*)malloc(LEN);printf("Welcometostudentjiguansystem!");
5、printf("Pleaseinputone'snum,nameandjiguan");printf(""000":exit");scanf("%ld%s%s",&p1->num,p1->name,p1->jg);head=NULL;while(p1->num!=0){n=n+1;if(n==1)head=p1;elsep2->next=p1;p2=p1;p1=(structstudent*)malloc(LEN);scanf("%ld%s%s",&p1->num,p1->name,p1->jg);}p2->next=NULL;fre
6、e(p1);printf("Save?Y/N");scanf("%c",&ch);scanf("%c",&ch);if(ch=='y'
7、
8、ch=='Y')save(head);print(head);return(head);}voidloadf(){FILE*fp;intN=n;charfilename[20];structstudent*p1;p1=(structstudent*)malloc(LEN);printf("Pleaseinputthefilename");scanf("%s",filename);if((fp=fopen
9、(filename,"r"))==NULL){printf("cannotopenfile");return;}printf("Filehasbeenopen:");for(;N!=0;N--){fscanf(fp,"%ld%s%s",&p1->num,p1->name,p1->jg);printf("%ldt%stt%s",p1->num,p1->name,p1->jg);}free(p1);fclose(fp);}voidxsearch(structstudent*head){longnum;structstudent*p1
10、,*p2;intc=0;printf("Pleaseinputthesearchnumber:");scanf("%ld",&num