Good Morning
05:46 am

Sponsor Area

Sponsor Area

Question is

Find the output of the following C++ code considering that the binary file BOOK.DAT exists on the hard disk with a data of 200 books.

class BOOK
{
	int BID;char BName[20];
public:
	void Enter();void Display();
};

void main()
{
	fstream InFile;
	InFile.open('BOOK.DAT',ios::binary|ios::in);
	BOOK B;
	InFile.seekg(5*sizeof(B));
	InFile.read((char*)&B, sizeof(B));
	cout<<'Book Number:'<<InFile.tellg()/sizeof(B) + 1;
	InFile.seekg(0,ios::end);
	cout<<' of '<<InFile.tellg()/sizeof(B)<<endl;
	InFile.close();
}

Mock Test Series

Sponsor Area

Sponsor Area

NCERT Book Store

NCERT Sample Papers

Entrance Exams Preparation