ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:17.74KB ,
资源ID:5879890      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5879890.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(通讯录管理软件C++编程.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

通讯录管理软件C++编程.docx

1、通讯录管理软件C+编程#include #include #include #include #include /文本操作默认信息保存在工程文件夹下#define N 40 /定义基本信息的长度int t;using namespace std;char nameN; /全局变量定义char addressN;char phoneN;char codeN;char emailN;class hum private: char nameN; /基础类的定义 char addressN; char phoneN; char codeN; char emailN; public: hum *next

2、; hum() hum() friend class List;class List:public hum /私有信息封装private: hum *head,*tail;public: List(); List(); void CreatList(); void set(char *name= .,char *address= .,char *phone= .,char *code= .,char *email= .); void Delete(int t); void Change(char *name); void Find(int x); void filecin(); void fi

3、leout(); void showall();List:List() head=tail=NULL;List:List() hum *p; if(head) p=head; head=head-next; delete p; void List:set(char *name,char *address,char *phone,char *email,char *code) /文本导入时调用的构造函数 hum *p=new hum; strcpy(p-name,name); strcpy(p-address,address); strcpy(p-phone,phone); strcpy(p-c

4、ode,code); strcpy(p-email,email); p-next=NULL; if(head=NULL) head=p; else tail-next=p; tail=p;void List:CreatList() /默认的构造函数 int flag=1; hum *p=new hum; strcpy(p-name, .); strcpy(p-address, .); strcpy(p-phone, .); strcpy(p-code, .); strcpy(p-email, .); getchar(); coutname,name); coutaddress,address)

5、; coutphone,phone); coutcode,code); coutemail,email); hum *q=head; while(q) /判断是否以存在相同的信息 if(strcmp(q-name,name)=0&strcmp(q-address,address)=0&strcmp(q-phone,phone)=0&strcmp(q-code,code)=0&strcmp(q-email,email)=0) flag=0; coutnext; if(flag) ofstream outfile; outfile.open(cin.txt,ios:app); /将新数据添加的文本

6、末尾 if(!outfile) /调试期间怕出错添加的判断函数 cerrFile open or create error!endl; exit(1); outfileendlname address phone code email; outfile.close(); p-next=NULL; if(head=NULL) head=p; else tail-next=p; tail=p; cout信息已经存入通讯录。n; void List:Delete(int t) /删除函数 coutshuru; hum *p=head,*q; char flag; while(p) if(strcmp

7、(p-name,shuru)=0&t=1)|(strcmp(p-phone,shuru)=0&t=2)|(strcmp(p-code,shuru)=0)&t=3) cout确定要删除该信息y OR nflag; if(flag=Y|flag=y) if(p=head) head=p-next; else q-next=p-next; delete p; break; break; q=p; p=p-next; ofstream outfile; outfile.open(cin.txt,ios:trunc); if(!outfile) /调试期间怕出错添加的判断函数 cerrFile open

8、 or create error!next) /链表输出信息至文本 outfilename address phone code emailnext; /将删除后的信息存入cin.txt文件中保存 outfilename address phone code email; outfile.close(); system(cls); /每次程序的最终结果都清屏一次,并给出程序最后的结果,方便使用者查看 cout程序运行结果:n; if(flag=Y|flag=y) cout已删除成功!nendl; else if(flag!=Y|flag!=y) cout信息成员未删除.n; else cout

9、通讯录无此人!nname,name)=0) cout姓名: nname 地址: address 电话: phone 邮编: code E-mail:emailendl; getchar(); cout-无需修改选项直接回车!-n; /对于无需修改的项目不需要重复填入,方便使用者 cout输入要修改成的地址:; gets(address); cout输入要修改成的电话:; gets(phone); cout输入要修改成的邮编:; gets(code); coutaddress,address); if(strcmp(code,)!=0) strcpy(p-code,code); if(strcm

10、p(email,)!=0) strcpy(p-email,email); if(strcmp(phone,)!=0) strcpy(p-phone,phone); flag=1; coutnext; hum *q=head; ofstream outfile; outfile.open(cin.txt,ios:trunc); if(!outfile) /调试期间怕出错添加的判断函数 cerrFile open or create error!next) /链表输出信息至文本 outfilename address phone code emailnext; /将删除后的信息存入cin.txt文

11、件中保存 outfilename address phone code email; outfile.close(); system(cls); coutendl; if(flag=0) cout程序最终结果:n; cout通讯录不包含这个人!nendl; else cout程序最终结果:n; cout姓名: nameendl 地址: address 电话: phone 邮编: code E-mail:emailendl; cout信息修改成功!nendl; coutendlendl; void List:Find(int x) /1、按名字查找2、按电话查找3、按邮编查找4、按E-mail查

12、找 char shuruN; coutshuru; int flag=0; hum *p=head; while(p) /查找时4种条件,方便使用者。 if(strcmp(p-name,shuru)=0&x=1)|(strcmp(p-phone,shuru)=0&x=2)|(strcmp(p-code,shuru)=0)&x=3|(strcmp(p-email,shuru)=0&x=4) system(cls); coutendl; cout程序最终结果:n查找人:n; cout姓名: name 地址: address 电话: phone 邮编: code E-mail:emailnext;

13、coutendl; if(flag=0) system(cls); cout程序最终结果:n; cout通讯录不包含这个人!nendl; coutendlendl; void List:filecin() /默认导入文本信息至程序 ifstream txtfile; txtfile.open(cin.txt); if(!txtfile) cerrtxt open error!nameaddressphonecodeemail; List:set(name,address,phone,code,email); txtfile.close(); void List:fileout() /导出信息至

14、文本 fstream outfile; outfile.open(cout.txt,ios:out|ios:trunc); if(!outfile) /调试期间怕出错添加的判断函数 cerrFile open or create error!endl; exit(1); hum *p=head; while (p) /链表输出信息至文本 outfilename address phone code emailnext; system(cls); coutendl; cout程序最终结果:n; printf(导出信息至文本成功!n); outfile.close(); coutendl; voi

15、d List:showall() /链表输出各个成员信息 hum *p=head; while(p) cout姓名:nameendl 地址:address 电话:phone 邮编:email E-mail:codenext; int main() List TXL; int n=1; /n表示要输入的操作步骤 TXL.filecin(); /程序打开默认导入记录在cin.txt中的文件内容。 while(n) cout 欢迎使用通信簿!n; /用户友好界面 cout 请选择以下操作!n; cout !-1-添加通讯录信息n; cout !-2-修改通讯录信息n; cout !-3-删除通讯录信

16、息n; cout !-4-查找通讯录信息n; cout !-5-输出通讯录信息n; cout !-6-文本导出信息n; cout !-7-退出通讯录n; coutn; switch(n) case 1: TXL.CreatList(); /在程序运行时添加成员 break; case 2: coutname; TXL.Change(name); break; case 3: cout1-根据姓名删除信息n; /不同的删除方式。 cout2-根据电话删除信息n; coutt; TXL.Delete(t); break; case 4: cout查找方式endl; /不同的查找方式。 cout-1、按名字查找 n-2、按电话查找 n-3、按邮编查找 n-4、按E-mail查找endl; coutx; TXL.Find(x); break; case 5: TXL.showall(); break; case 6: TXL.fileout();break; /文件导出最终结果 case 7: n=0; break; default: cout操作错误!endl;break; coutendl; return 0;

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1