Page 442 - C++
P. 442
if(strcmpi(name1,C.Return_Name())==0)
{
flag=1;
}
else
{
fout.write((char*)&C,sizeof(C));
}
}
if(flag==1)
{
cout<<"\nWelcome "<<name1;
cout<<"\nEnter new details ";
C.CGetdata();
fout.write((char*)&C,sizeof(C));
cout<<"\nYour record has been modified :)";
}
if(flag==0)
{
cout<<"\nNo record found";
}
fin.close();
fout.close();
remove("contact.dat");
rename("temp.dat","contact.dat");
}
/*************************************************************/
void q_telephone()
{
char qph[15];
int flag=0;
ifstream fin("contact.dat",ios::in|ios::binary);
Contact C;
cout<<"\nEnter the Telephone Number you want to find : ";
gets(qph);
while(fin.read((char*)&C,sizeof(C)))
{
if(strcmpi(qph,C.Return_Telephone())==0)
{
flag=1;
C.CDisplaydata();
}
}
if(flag==0)
{
cout<<"\nNo record found";
}
getch();
}
/*************************************************************/
void q_name()
{
char qname[20];