l来源
同学的大作业内容
2运行环境与运行结果VS2023
3改善点
没有修改联系人的选项
无法清空联系人,只能一个一个删除
无法对联系人排序
4新代码
void allClean(Addressbooks* abs)
{
cout << "您确定是要执行本操作吗?" << endl;
cout << "1 --- 是" << endl;
cout << "2 --- 否" << endl;
int select;
cin >> select;
if (select == 1)
{
abs->m_Size = 0;
cout << "通讯录已清空!" << endl;
}
system("pause");
system("cls");
}
void Search(Addressbooks* abs)
{
string name;
cout << "请输入您要找的联系人" << endl;
cin >> name;
int ret = isExist(abs, name);
cout << "姓名: " << abs->personArray[ret].name << "\t";
cout << "性别: " << (abs->personArray[ret].sex == 1 ? "男" : "女") << "\t";
cout << "年龄: " << abs->personArray[ret].age << "\t";
cout << "电话: " << abs->personArray[ret].phone << "\t";
cout << "家庭住址: " << abs->personArray[ret].addr << endl;
system("pause");
system("cls");
}
void Modify(Addressbooks* abs)
{
string name;
cout << "请输入您要修改的联系人的姓名: " << endl;
cin >> name;
int ret = isExist(abs, name);
if (ret != -1)
{
system("cls");
showMenu();
cout << "已找到该联系人,请修改: " << endl;
cout << "姓名 : " << endl;
cin >> abs->personArray[ret].name;
cout << "性别 : " << endl;
cin >> abs->personArray[ret].sex;
cout << "年龄 : " << endl;
cin >> abs->personArray[ret].age;
cout << "电话号码 :" << endl;
cin >> abs->personArray[ret].phone;
cout << "家庭住址 :" << endl;
cin >> abs->personArray[ret].addr;
cout << "修改成功!" << endl;
}
system("pause");
system("cls");
}
cout << "***** 5、修改联系人 " << endl;
cout << " 6、清空联系人 " << endl;
cout << " 7、联系人排序 *****" << endl;
5新的运行结果
6难点总结
1】重新阅读代码,理解代码
2】发现代码的功能不足之处
3】编写不熟悉的代码的新的功能