Page 443 - C++
P. 443
int flag=0;
ifstream fin("contact.dat",ios::in|ios::binary);
Contact C;
cout<<"\nEnter the Name you want to find : ";
gets(qname);
while(fin.read((char *)&C,sizeof(C)))
{
if(strcmpi(qname,C.Return_Name())==0)
{
flag=1;
C.CDisplaydata();
}
}
if(flag==0)
{
cout<<"\nNo record found";
}
getch();
}
/*************************************************************/
void q_add()
{
char qadd[50];
int flag=0;
ifstream fin("contact.dat",ios::in|ios::binary);
Contact C;
cout<<"\nEnter the Address you want to find : ";
gets(qadd);
while(fin.read((char *)&C,sizeof(C)))
{
if(strcmpi(qadd,C.Return_Address())==0)
{
flag=1;
C.CDisplaydata();
}
}
if(flag==0)
{
cout<<"\nNo record found";
}
getch();
}
/*************************************************************/
void q_mob()
{
char qmob[15];
int flag=0;
ifstream fin("contact.dat",ios::binary|ios::in);
Contact C;
cout<<"\nEnter any Mobile Number(1 or 2) you want to find : ";
gets(qmob);
while(fin.read((char *)&C,sizeof(C)))
{