int E1(Addressbooks* abs, string name,int begin=0) {///////////////////
for (int i = begin; i < abs->m_Size; i++) {
//如果找到
if (abs->personArry[i].m_Name == name) {
return i;
}
}
return -1;
}
void findPerson1(Addressbooks* abs) {
cout << "请输入您要查找的姓名" << endl;
string name;
cin >> name;
//判断
int r=-1,flag=1;//////////
while(1)////////////
{
r = E1(abs, name,r+1);////////////////
if (r != -1)
{
cout << "姓名;" << abs->personArry[r].m_Name << "\t";
cout << "性别;" << abs->personArry[r].m_Sex << "\t";
cout << "联系电话:" << abs->personArry[r].m_Phone << "\t";
cout << "地址:" << abs->personArry[r].m_Add << "\t";
cout << "邮编:" << abs->personArry[r].m_Pcoad << "\t";
cout << "QQ:" << abs->personArry[r].m_QQ << "\t";
cout << "工作单位:" << abs->personArry[r].m_Uow << endl;
flag=0;/////////////
}
else
break;///////////
}
if(flag)/////////
{
cout << "查无此人" << endl;
}
system("pause");
system("cls");//清屏
}
|