For Daily Free Study Material Join wiredfaculty Whatsapp Group | Download Android App | Ncert Book Download
Sponsor Area
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(); }