通讯录管理系统(简易)
#include<iostream>
#define MAX 1000
using namespace std;
struct Person
{
string m_Name;
int m_Sex;
int m_Age;
string m_Phone;
string m_Addr;
};
struct Addressbooks
{
struct Person personArray[MAX];
int m_Size;
};
void showMenu()
{
cout << "*************************" << endl;
cout << "****** 这是菜单 *******" << endl;
cout << "****** 1.添加联系人 ****" << endl;
cout << "****** 2.显示联系人 *******" << endl;
cout << "****** 3.删除联系人 *******" << endl;
cout << "****** 4.查找联系人 *******" << endl;
cout << "****** 5.修改联系人 *******" << endl;
cout << "****** 6.清空联系人 *******" << endl;
cout << "****** 0.退出通讯录 *******" << endl;
cout << "***************************" << endl;
}
void addPenson(Addressbooks* abs)
{
if (abs->m_Size == MAX)
{
cout << "通讯录已满,无法添加" << endl;
return;
}
else
{
string name;
cout << "请输入姓名:" << endl;
cin >> name;
abs->personArray[abs->m_Size].m_Name = name;
cout << "请输入性别:" << endl;
cout << "1. 表示男生" << endl;
cout << "2. 表示女生" << endl;
int sex = 0;
while (true)
{
cin >> sex;
if (sex == 1 || sex == 2)
{
abs->personArray[abs->m_Size].m_Sex = sex;
break;
}
cout << "输入有误,请重新输入!" << endl;
}