ifstream inData("pbook.txt",ios::in);
bool flag = true;
string record;
while (getline(inData, record))
{
if (flag)
{
cout <<endl <<"所有联系人信息如下: "<<endl;
}
cout <<record <<endl;
flag = false;
}
if (flag)
{
cout <<endl <<"你的通迅录中没有联系人!!!!!" <<endl <<endl;
}
else
{
cout <<endl <<"所有联系人已经全部显示出来!!!!!" <<endl <<endl;
}
system("pause");
}
慕妹3146593
RISEBY