Advertisement Remove all ads

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 - Computer Science (C++)

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();
}
Advertisement Remove all ads

Solution

Present Record: 3

Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File
  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×