C课程设计(通讯录管理系统)
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
people[j] = temp;
}
}
cout << "排序完成!" << endl;
for (w = 0; w < num; w++)
exit(1);
}
else
{
for (int i = 0; i < num; i++)
{
infile >> name1 >> phone1 >> address1 >> remark1;
people[i].set(name1, phone1, address1, remark1);
}
infile.close();
}case 2:
break;
整理ppt
11
for (w = 0; w < num - 1; w++)
for (j = w + 1; j < num; j++)
{
if (people[w].get_name() <
people[j].get_name())
{
temp = people[w];
people[w] = people[j];
{
cout << "按姓名排序:" << endl;
cout << "请选择排序方式:(1:顺序排序, 2 : 逆序排序)" << endl;
cin >> b;
switch (b)
{
case 1:
{
for (w = 0; w < num - 1; w++)
for (j = w + 1; j < num; j++)
{
if (people[w].get_name() > people[j].get_name())
{
temp = people[w];
people[w] = people[j];
people[j] = temp;
}
}
cout << "排序完成!" << endl;
for (w = 0; w < num; w++) people[w].show();
break;}
else if (j == num - 1)
cout << "未查找到该联系人!" << endl;}break;}
case 2:{cout << "请输入联系人电话:" << endl;
cin >> phone1;
for (j = 0; j < num; j++)
{
if (name1 == people[j].get_phone())
C++课程设计
——通讯录管理系统 制作人:姚博文 温裕 邓小隆
整理ppt
1
目录
一、工作流程
二、功能分析
三、程序结构
四、源程序代码
整理ppt
2
工作流程
收集资料,做前期准备工作
组内讨论,分析程序功能与结构
开始实验,初步完成代码
实验完成,优化并总结
整理ppt
3
功能分析
通讯录显示 添加联系人 删除联系人 修改联系人
查询联系人 修改密码 退出系统
整理ppt
4
通讯录系统
密码登陆
显
添
示
加
联
联
系
系
人
人
修 改 联 系 人
删 除 联 系 人
查 询 联 系 人
修 改 密 码
退 出 系 统
顺
倒
序
序
排
排
列
列
按
按
姓
电
名
话
查
查
询
询
整理ppt
5
程序结构
类:People 函数:cin_people() void sure_password()
seek_people() main() sort_people() write_people() revise_people() add_people() delete_people() menu()
整理ppt
6
整理ppt
7
class People { public:
People() {} People(string n, string p, string add, string re) ; ~People() {} void set(string n, string p, string add, string re); void set_name(string n); void set_phone(string p); void set_address(string add); void set_remarks(string re); string get_name(); string get_phone(); string get_address(); string get_remark(); void show();
10
void sort_people(int num, People people[])
{
int w;
People temp;
cout << "请选择排序方式:(1:姓名,2:电话,3:退出排序)" << endl; //选择排序
int d, j,b;
cin >> d;
switch (d)
{
case 1:
{cout << "已查找到联系人,信息如下:" << endl;
people[j].show();
break;}
else if (j == num - 1)
cout << "未查找到该联系人!" << endl;}
break;
}
case 3:break;
}}}
default:break;
整理ppt
cout << "联系人已读入!" << endl;
}
}
整理ppt
9
void seek_people(int num, People people[])
{
if (num != 0)
{cout << "请选择查询方式:(1:姓名,2:电话,3:退出查询)" << endl;
int d, j;
cin >> d;
string name1, phone1;
switch (d)
{
case 1:
{cout << "请输入联系人姓名:" << endl;
cin >> name1;
for (j = 0; j < num; j++)
{if (name1 == people[j].get_name()){
cout << "已查找到联系人,信息如下:" << endl; people[j].show();
整理ppt
8
void cin_people(int num, People people[])//读入
{string name1, phone1, address1, remark1;
ifstream infios::in);
if (!infile){
cout << "open error!" << endl;