हिंदी

Find the Output of the Following C++ Code Considering that the Binary File School.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) - Computer Science (C++)

Advertisements
Advertisements

प्रश्न

Find the output of the following C++ code considering that the binary file SCHOOL.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 Educa t for Life School 50
1005 Guru Shiahya Sadan 195
1004 Holy Education School 140
1010 Play 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(S*sizeof(S));
     SFIN.read((char*)&S, sizeof(S));
     S.Display();
     cout<<"Record : "<<SFIN.tellg()/sizeof(S) + l <<endl;
     SFIN.close();
}

उत्तर

Record: 7

shaalaa.com
Implementation of Basic File Operations on Text and Binary File in C++
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2017-2018 (March) All India Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×