c语言学生通信录管理系统课程设计报告2

c语言学生通信录管理系统课程设计报告2

ID:34588901

大小:100.00 KB

页数:22页

时间:2019-03-08

c语言学生通信录管理系统课程设计报告2_第1页
c语言学生通信录管理系统课程设计报告2_第2页
c语言学生通信录管理系统课程设计报告2_第3页
c语言学生通信录管理系统课程设计报告2_第4页
c语言学生通信录管理系统课程设计报告2_第5页
资源描述:

《c语言学生通信录管理系统课程设计报告2》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、E、删除voiddel1()开始按电话择调用deltel()按名字择调用delname()按名字或按电话删除结束入口按名字(学号)查找学生第一个节点p1->next=head没找到,输出“notfind!”中间节点p2->next=p1->next结束重建链表用recreact()函数程序清单:1、voiddel1(){inti;printf("

2、---------------------------------

3、");printf("

4、1.deleteintel

5、");printf("

6、

7、2.deleteinname

8、");printf("

9、0.regiter

10、");printf("

11、---------------------------------

12、");do{printf("inputyourchoice");scanf("%d",&i);}while(i!='1'&&i!='2'&i!='0');if(i==1)deltel();elseif(i==2)delname();elseexit(0);}2、voiddelname(){chari;FILE*fp;str

13、uctstudent*p1,*p2,*head;charname[16],c;head=recreat();p1=head;printf("inputthestudent'sname:");scanf("%s",name);while(strcmp(p1->name,name)!=0&&p1->next!=NULL){p2=p1;p1=p1->next;}if(strcmp(p1->name,name)==0){if(p1==head)head=p1->next;elsep2->next=p1

14、->next;printf("deletesuccess!");printf("savethemorno(y/n)");do{printf("inputchoice");getchar();scanf("%c",&i);}while(i!='y'&&i!='Y'&&i!='n'&&i!='N');if(i=='y'

15、

16、i=='Y'){p1=head;if((fp=fopen(FILENAME,"wb"))==NULL){printf("cannotopenfile");retu

17、rn;}if(p1!=NULL)do{if(fwrite(p1,sizeof(structstudent),1,fp)!=1){printf("filewriteerror");fclose(fp);break;}p1=p1->next;}while(p1!=NULL);fclose(fp);exit(0);}}elseprintf("Notfind!");}3、voiddeltel(){chari;FILE*fp;structstudent*p1,*p2,*head;chartel[18

18、],c;head=recreat();p1=head;printf("inputthestudent'stelephonenumber:");scanf("%s",tel);while(strcmp(p1->tel,tel)!=0&&p1->next!=NULL){p2=p1;p1=p1->next;}if(strcmp(p1->tel,tel)==0){if(p1==head)head=p1->next;elsep2->next=p1->next;printf("deletesuccess!

19、");printf("savethemorno(y/n)");do{printf("inputchoice");getchar();scanf("%c",&i);}while(i!='y'&&i!='Y'&&i!='n'&&i!='N');if(i=='y'

20、

21、i=='Y'){p1=head;if((fp=fopen(FILENAME,"wb"))==NULL){printf("cannotopenfile");return;}if(p1!=NULL)do{if(fwrite(

22、p1,sizeof(structstudent),1,fp)!=1){printf("filewriteerror");fclose(fp);break;}p1=p1->next;}while(p1!=NULL);fclose(fp);exit(0);}}elseprintf("Notfind!");}F、修改voidmodify()开始按学号则调用modifynum()按名字则调用modifyname()按名字或按学号找到修改结束入口找到,用scanf函数重新赋值按名字(

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。