Question:
Find the output of the following C++ code considering that the binary file SCHOOLS.DAT exists on the hard disk with the following records of 10 schools of the class SCHOOLS as declared in the previous question (4 b).
| SCode | SName | NOT |
|---|---|---|
| 1001 | Brains School | 100 |
| 1003 | Child Life School | 115 |
| 1002 | Care Share School | 300 |
| 1006 | Educate for Life School | 50 |
| 1005 | Guru Shishya Sadan | 195 |
| 1004 | Holy Education School | 140 |
| 1010 | Rahmat E Talim School | 95 |
| 1008 | Innovate Excel School | 300 |
| 1011 | Premier Education School | 200 |
| 1012 | Uplifted Minds School | 100 |
void main()
{
fstream SFIN;
SFIN.open("SCHOOLS.DAT",ios::binary|ios::in);
SCHOOLS S;
SFIN.seekg(5*sizeof(S));
SFIN.read((char*)&S, sizeof(S));
S.Display();
cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
SFIN.close();
}
C. Sir| Created: 2-Jan-2019 | Updated: 22-Mar-2026|CBSE12A-2018
