c语言编写的通讯录代码、

c语言编写的通讯录代码、

ID:8976303

大小:45.00 KB

页数:7页

时间:2018-04-13

c语言编写的通讯录代码、_第1页
c语言编写的通讯录代码、_第2页
c语言编写的通讯录代码、_第3页
c语言编写的通讯录代码、_第4页
c语言编写的通讯录代码、_第5页
资源描述:

《c语言编写的通讯录代码、》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、#include#includestructfriends_list{charname[10];intage;chartelephone[13];};intCount=0;voidnew_friend(structfriends_listfriends[]);voidsearch_friend(structfriends_listfriends[],char*name);voidModify_friend(structfriends_listfriends[],char*name);voidDelete_friend(structfr

2、iends_listfriends[],char*name,intn);intmain(void){intchoice,n;charname[10];structfriends_listfriends[50];do{printf("手机通讯录功能选项:1:新建2:查询3:修改4:删除0:退出");printf("请选择功能:");scanf("%d",&choice);switch(choice){case1:new_friend(friends);break;case2:printf("请输入要查找的联系人姓名:");scanf("%s",name);search_

3、friend(friends,name);break;case3:printf("请输入您要修改的联系人的姓名:"); scanf("%s",name);printf("");Modify_friend(friends,name);break;case4:printf("1:单个删除2:全部删除");printf("请选择您需要的操作:");scanf("%d",&n);if(n==1){printf("输入名字");scanf("%s",name); Delete_friend(friends,name,n);break;}if(n==2){Dele

4、te_friend(friends,name,n);break;}case0:break;}}while(choice!=0);printf("谢谢使用通讯录功能!");return0;}voidnew_friend(structfriends_listfriends[]){structfriends_listf;if(Count==50){printf("通讯录已满!");return;}printf("请输入新的联系人的姓名:");scanf("%s",f.name);printf("请输入新联系人的年龄:");scanf("%d",&f.age);print

5、f("请输入新联系人的联系电话:");scanf("%s",f.telephone);friends[Count]=f;Count++;}/*查询联系人*/voidsearch_friend(structfriends_listfriends[],char*name){inti,flag=0;if(Count==0){printf("通讯录是空的!");return;}/*在书本源代码的基础上,我修改了一下,让程序可以查询多个相同名字的联系人*/for(i=0;i

6、("姓名:%st",friends[i].name);printf("年龄:%dt",friends[i].age);printf("电话:%s",friends[i].telephone);flag++;}if(flag==0) printf("无此联系人!");}/*修改联系人*/voidModify_friend(structfriends_listfriends[],char*name){intk,y=0;intt,j=1,g=0;structfriends_listx;if(Count==0){printf("通讯录是空的!");return;}

7、/*首先,判断要修改的联系人中有没有相同的名字*/for(k=0;k

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

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

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