Hi ! Studying late night...
02:55 am

Sponsor Area

Sponsor Area

Question is

Find the output of the following C++ code considering that the binary file MEM.DAT exists on the hard disk with a data of 1000 members.

class MEMBER
{
	int Mcode;char MName[20];
public:
	void Register();void Display();
};
void main()
{
	fstream MFile;
	MFile.open('MEM.DAT',ios::binary|ios::in);
	MEMBER M;
	MFile.read((char*)&M, sizeof(M));
	cout<<'Rec:'<<MFile.tellg()/sizeof(M)<<endl;
	MFile.read((char*)&M, sizeof(M));
	MFile.read((char*)&M, sizeof(M));
	cout<<'Rec:'<<MFile.tellg()/sizeof(M)<<endl;
	MFile.close();
}

Mock Test Series

Sponsor Area

Sponsor Area

NCERT Book Store

NCERT Sample Papers

Entrance Exams Preparation