界面展示:
1,菜单界面
2,添加联系人
选择按钮1。
3,显示联系人
选择按钮2,会显示当前通讯录里面的所有联系人信息
#include<iostream>
using namespace std;
#include<string>
//设置最大容量
#define MAXSIZE 300
//联系人结构体
struct person {
string name;
string gender;
int age;
string tlenumber;
string address;
};
通讯录结构体
struct comsys {
struct person p_arry[MAXSIZE];
int length;
};
//主函数
int main(void) {
//初始化结构体数组
comsys com;
com.length = 0;
//函数声明
void showMenu();
void addPerson(comsys * p);
void showPerson(comsys * p);
void printInfoN(comsys * p, int n);
void printInfoI(comsys * p, int i);
int locatePerson(comsys * p, string name, string number);
void serchPerson(comsys * p);
void deletePerson(comsys * p);
void modifyPerson(comsys * p);
void clearPerson(comsys * p);
//函数调用
while (true) {
showMenu();
int select = 0;
cin >> select;
switch (select)
{
case 1://添加
addPerson(&com);
system("pause");
system("cls");
break;
case 2://显示
showPerson(&com);
system("pause");
system("cls");
break;
case 3://删除
deletePerson(&com);
system("pause");
system("cls");
break;
case 4://查找
serchPerson(&com);
system("pause");
system("cls");
break;
case 5://修改
modifyPerson(&com);
system("pause");
system("cls");
break;
case 6://清空
clearPerson(&com);
system("pause");
system("cls");
break;
case 0://退出
cout <&