当前位置:文档之家› C课程设计(通讯录管理系统)

C课程设计(通讯录管理系统)

} break;
for (j = w + 1; j < num; j++) {
if (people[w].get_name() <
{
} } cout << "排序完成!" << endl; for (w = 0; w < num; w++) people[w].show(); break;
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; } }
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();
通讯录系统
密码登陆










修 改 联 系 人
删 除 联 系 人
查 询 联 系 人
修 改 密 码
退 出 系 统


















程序结构
类:People 函数:cin_people() void sure_password()
seek_people() main() sort_people() write_people() revise_people() add_people() delete_people() menu()
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();
C++课程设计
——通讯录管理系统 制作人:姚博文 温裕 邓小隆
目录
一、工作流程 二、功能分析 三、程序结构 四、源程序代码Fra bibliotek工作流程
收集资料,做前期准备工作 组内讨论,分析程序功能与结构
开始实验,初步完成代码 实验完成,优化并总结
功能分析
通讯录显示 添加联系人 删除联系人 修改联系人
查询联系人 修改密码 退出系统
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()) {cout << "已查找到联系人,信息如下:" << endl; people[j].show(); break;} else if (j == num - 1) cout << "未查找到该联系人!" << endl;} break; } case 3:break; default:break; }}}
infile >> name1 >> phone1 >> address1 >> remark1; people[i].set(name1, phone1, address1, remark1); } infile.close(); cout << "联系人已读入!" << endl; } }
void seek_people(int num, People people[]) {
cout << "排序完成!" << endl; for (w = 0; w < num; w++) people[w].show(); break; }case 2:
for (w = 0; w < num - 1; w++) people[j].get_name())
} case 2: {
} default:
void cin_people(int num, People people[])//读入 {string name1, phone1, address1, remark1;
ifstream infile("phonebook.txt", ios::in); if (!infile){
cout << "open error!" << endl; exit(1); } else { for (int i = 0; i < num; i++) {
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: {
相关主题