Page 330 - C++
P. 330

(c)     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).                                                    1


                    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             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(5*sizeof(S));

                       SFIN.read((char*)&S, sizeof(S));
                       S.Display();

                       cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;

                       SFIN.close();
                   }

      91                                            11                                        P.T.O.
   325   326   327   328   329   330   331   332   333   334   335