南航通讯录管理系统C++课设源程序.docx

上传人:b****1 文档编号:2773322 上传时间:2023-05-04 格式:DOCX 页数:27 大小:19.33KB
下载 相关 举报
南航通讯录管理系统C++课设源程序.docx_第1页
第1页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第2页
第2页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第3页
第3页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第4页
第4页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第5页
第5页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第6页
第6页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第7页
第7页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第8页
第8页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第9页
第9页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第10页
第10页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第11页
第11页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第12页
第12页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第13页
第13页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第14页
第14页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第15页
第15页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第16页
第16页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第17页
第17页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第18页
第18页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第19页
第19页 / 共27页
南航通讯录管理系统C++课设源程序.docx_第20页
第20页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

南航通讯录管理系统C++课设源程序.docx

《南航通讯录管理系统C++课设源程序.docx》由会员分享,可在线阅读,更多相关《南航通讯录管理系统C++课设源程序.docx(27页珍藏版)》请在冰点文库上搜索。

南航通讯录管理系统C++课设源程序.docx

南航通讯录管理系统C++课设源程序

课题内容与要求

通信录管理系统

用C/C++设计出模拟手机通信录管理系统,实现对手机中的通信录进行管理。

(一)功能要求

(1)查看功能:

选择此功能时,列出下列三类选择。

A办公类B个人类C商务类,当选中某类时,显示出此类所有数据中的姓名和电话号码)

(2)增加功能:

能录入新数据(一个结点包括:

姓名、电话号码、分类(可选项有:

A办公类B个人类C商务类)、电子邮件)。

例如

杨春13589664454商务类chuny@

当录入了重复的姓名和电话号码时,则提示数据录入重复并取消录入;当通信录中超过15条信息时,存储空间已满,不能再录入新数据;录入的新数据能按递增的顺序自动进行条目编号。

(3)拔号功能:

能显示出通信录中所有人的姓名,当选中某个姓名时,屏幕上模拟打字机的效果依次显示出此人的电话号码中的各个数字,并伴随相应的拔号声音。

(4)修改功能:

选中某个人的姓名时,可对此人的相应数据进行修改

(5)删除功能:

选中某个人的姓名时,可对此人的相应数据进行删除,并自动调整后续条目的编号。

(二)其它要求:

(1)只能使用C/C++语言,源程序要有适当的注释,使程序容易阅读

(2)至少采用文本菜单界面(如果能采用图形菜单界面更好)

(3)建议使用结构和链表等数据结构

(4)学生可自动增加新功能模块(视情况可另外加分)

(5)写出课程设计报告,具体要求见相关说明文档

#include"stdafx.h"

//PASSWORD:

密码登陆

//Password.h文件的内容:

#include"stdafx.h"

#ifndefPASSWORD_H

#definePASSWORD_H

intenter();//登录页面

intcheck();//核对密码

voidlogin();//注册

#endif

//文件Password.cpp的内容:

#include

#include

#include"password.h"

#include

#include

#include

#include

#include

#include

usingnamespacestd;

stringuser;//用户名

stringcode;//密码

stringcode1;//注册密码

intcheck()

{

ifstreaminfile("code.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

exit

(1);

}

stringsign;//定义用户名字符串

stringsign1;//定义密码字符串

cout<

";

cin>>sign;

fflush(stdin);

cout<

";

cin>>sign1;

fflush(stdin);//清除缓存

intflag=1;

stringstr;

while(infile>>user>>code)//读出数据

{

getline(infile,str);

if((user==sign)&&(code==sign1))//检查用户名,密码是否正确

{

cout<

flag=0;

}

}

cout<

请重新输入!

"<

system("pause");//显示“按任意键继续……

returnflag;

}

voidlogin()//用户注册

{

system("cls");//清屏

cout<<"请输入管理员注册权限密码:

";

stringstr;

str="123456";

stringstr1;

cin>>str1;

if(str1==str)

{

cout<<"通过认证!

"<

cout<<"请创建新的用户名:

";

cin>>user;

fflush(stdin);

cout<<"请输入密码:

";

cin>>code;

fflush(stdin);

cout<<"请重新输入密码:

";

cin>>code1;

while(code!

=code1)//比较两次输入的密码

{

cout<<"创建失败!

"<

cout<<"请重新输入密码:

";

cin>>code1;

}

cout<<"创建成功!

"<

ofstreamoutfile("code.txt",ios:

:

app);//以追加模式打开文件

if(!

outfile)

{

cout<

文件打开失败!

"<

system("pause");

}

outfile<

:

left)<

outfile.close();//关闭文件

cout<<"用户已成功保存!

"<

system("pause");

}

else

{

cout<

您没有通过注册认证!

"<

cout<

QQ:

123456789;tel:

12345678989"<

system("pause");

}

}

intenter()//登录页面

{

system("cls");//清屏

system("color9D");//背景与字体颜色

cout<

<<"\t\t************************************************"<

<<"\t\t通讯录登录系统"<

<<"\t\t1.登录"<

<<"\t\t2.注册"<

<<"\t\t0.退出"<

<<"\t\t************************************************"<

<<"\t\t选择:

";

intchoose;

cin>>choose;

fflush(stdin);

returnchoose;

}

//通信录管理系统_xxxxxxxxx.cpp文件的内容

#include

#include

#include"password.h"

#include

#include

#include

#include

#include

#include

usingnamespacestd;

classbook

{

public:

book();//构造函数

intenter1();//管理首页

voidaddPer();//添加联系人

voiddelPer();//删除联系人

voidalter();//修改信息

voidcall();//拨号

voidshowall();//显示所有联系人的信息

voidsave();//保存

voidshow();//显示查询的类型

voidshowA();//显示类型A

voidshowB();//显示类型B

voidshowC();//显示类型C

private:

stringname;//姓名

stringnumber;//电话

stringtype;//类型

stringemail;

};

structrecord

{

bookobject;

record*prior;

record*next;

};

book:

:

book()//构造函数

{

name='\0';

type='\0';

number='\0';

email='\0';

}

intbook:

:

enter1()//管理页面

{

system("cls");

system("color7D");//背景与字体颜色

cout<

cout<

cout<<"\t\t\t*****************************************"<

<<"\t\t\t通讯录管理系统"<

<<"\t\t\t"<

<<"\t\t\t1.添加新联系人2.删除联系人"<

<<"\t\t\t"<

<<"\t\t\t3.修改信息4.拨号"<

<<"\t\t\t"<

<<"\t\t\t5.查看联系人6.显示所有联系人"<

<<"\t\t\t"<

<<"\t\t\t7.关闭通讯录系统"<

<<"\t\t\t"<

<<"\t\t\t***********************************"<

<<"\t\t\t选择:

";

intchoose1;

cin>>choose1;

fflush(stdin);

returnchoose1;

}

voidbook:

:

addPer()//添加联系人

{

cout<

cout<<"姓名:

";

cin>>name;

fflush(stdin);

cout<<"电话:

";

cin>>number;

fflush(stdin);

cout<

cout<<"类型(A:

办公类B:

个人类C:

商务类):

";

cin>>type;

fflush(stdin);

cout<<"邮箱:

";

cin>>email;

fflush(stdin);

save();//保存

cout<

"<

system("pause");

}

voidbook:

:

delPer()//删除联系人

{

ofstreamoutfile("temp.txt",ios:

:

out);

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

outfile||!

infile)

{

cout<<"对不起!

文件打开失败!

"<

exit(0);

}

stringsign;

cout<

";

cin>>sign;

boolflag=true;

stringstr;

while(infile>>name>>number)

{

getline(infile,str);

if((sign==name)||(sign==number))

{

cout<

"<

cout<

:

left)<

flag=false;

break;

}

outfile<

:

left)<

}

if(flag)

{

cout<<"对不起!

未找到联系人!

"<

}

else

{

while(getline(infile,str))

{

outfile<

}

outfile.close();

infile.close();

ofstreamout("pbook.txt",ios:

:

out);

ifstreamin("temp.txt",ios:

:

in);

if(!

out||!

in)

{

cout<<"对不起!

文件打开失败!

"<

exit(0);

}

while(getline(in,str))

{

out<

}

out.close();

in.close();

cout<

"<

}

system("pause");

}

voidbook:

:

alter()//修改信息

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

exit(0);

}

stringsign;

cout<

";

cin>>sign;

fflush(stdin);

record*H=newrecord;//记录链表

record*p=H;

boolflag=true;

while(infile>>p->object.name>>p->object.number>>p->object.type>>p->object.email)

{

p->next=newrecord;

p=p->next;

}

p->next=NULL;

infile.close();

p=H;

while(p!

=NULL)

{

if((p->object.name==sign)||(p->object.number==sign))

{

if(flag)

{

cout<

"<

cout<

:

left)<

<object.name<<""<object.number

<<""<object.type

<<""<object.email<

flag=false;

}

cout<

"<

cout<<"姓名:

";

cin>>p->object.name;

fflush(stdin);

cout<<"电话:

";

cin>>p->object.number;

fflush(stdin);

cout<<"类型:

";

cin>>p->object.type;

fflush(stdin);

cout<<"邮箱:

";

cin>>p->object.email;

fflush(stdin);

break;

}

p=p->next;

}

if(flag)

{

cout<

通迅录中没有你要找的联系人!

"<

system("pause");

}

else

{

ofstreamout("pbook.txt",ios:

:

out);

if(!

out)

{

cout<

文件打开失败!

"<

system("pause");

}

p=H;

while(p!

=NULL)

{

out<

:

left)<object.name

<<""<object.number

<<""<object.type

<<""<object.email<

p=p->next;

}

out.close();

cout<

"<

system("pause");

}

}

voidbook:

:

call()//拨号功能

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

system("pause");

}

stringsign;

cout<

";

cin>>sign;

fflush(stdin);

boolflag=true;

stringstr;

while(infile>>name)

{

getline(infile,str);

if(sign==name)

{

cout<

"<

cout<

:

left)<

<<""<

cout<

for(inti=0;i<=11;i++)

{

cout<<'\a';

}

flag=false;

break;

}

}

system("pause");

}

voidbook:

:

showall()//显示所有联系人信息

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<<"对不起!

文件打开失败!

"<

system("pause");

}

stringrecord;

boolflag=true;

while(getline(infile,record))

{

if(flag)

{

cout<

"<

}

cout<

flag=false;

}

if(flag)

{

cout<

"<

}

else

{

cout<

"<

}

system("pause");

}

voidbook:

:

showA()//显示类型A

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

system("pause");

}

boolflag=true;

while(infile>>name>>number>>type>>email)

{

if(type=="A")

{

cout<

:

left)<

<<""<

<

<

<

flag=false;

}

}

system("pause");

infile.close();

}

voidbook:

:

showB()//显示类型B

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

system("pause");

}

boolflag=true;

while(infile>>name>>number>>type>>email)

{

if(type=="B")

{

cout<

:

left)<

<<""<

<

<

flag=false;

}

}

system("pause");

infile.close();

}

voidbook:

:

showC()//显示类型C

{

ifstreaminfile("pbook.txt",ios:

:

in);

if(!

infile)

{

cout<

文件打开失败!

"<

system("pause");

return;

}

boolflag=true;

while(infile>>name>>number>>type>>email)

{

if(type=="C")

{

cout<

:

left)<

<<""<

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2