Advertisements
Advertisements
Question
Find the output of the following C++ code considering that the binary file MEMBER.DAT exists on the hard disk with records of 100 members :
c1ass MEMBER
{
int Mno; char Name[20];
pub1ic:
void In();void Out();
};
void main()
{
fstream MF;
MF.open("MEMBER. DAT" , ios::binary|ios::in);,
MEMBER M;
MF.read((char*)&M, sizeof(M));
MF. read( (char*) &M, sizeof (M));
MF. read ((char*) &M, si:zeof (M));
int POSITION= MF. te11g 0 / sizeof (M);
cout<<"PRESENT RECORD:"<<POSITION<<end1;
MF.c1ose();
}
Solution
Present Record: 3
shaalaa.com
Is there an error in this question or solution?