Page 388 - C++
P. 388

else
         row++ ;
         } }
         if (!found)
         {
         gotoxy(5,10) ;
         cout<<"\7Records not found" ;
         }
         if (!flag)
         {
         gotoxy(5,23) ;
         cout <<"Press any key to continue. .." ;
         getch() ;
         }
         file.close() ;
         }
         //---------------------------------------------------------------------------
         // THIS FUNCTION DELETES PASSANGER RECORDS FOR THE GIVEN
         // TICKET NO.
         //---------------------------------------------------------------------------
         void PASSANGER :: DELETE_TICKET(int tno)
         {
         fstream file ;
         file.open("PASS.DAT", ios ::in|ios::binary) ;
         fstream temp ;
         temp.open("temp.dat", ios ::out|ios::binary) ;
         file.seekg(0,ios::beg) ;
         while (!file.eof())
         {
         file.read((char *) this, sizeof(PASSANGER)) ;
         if (file.eof())
         break ;
         if (tno != ticketno)
         temp.write((char *) this, sizeof(PASSANGER)) ;
         }
         file.close() ;
         temp. close () ;
         file.open("PASS.DAT", ios::out|ios::binary) ;
         temp.open("temp.dat", ios::in|ios::binary) ;
         temp.seekg(0,ios::beg) ;
         while ( !temp.eof() )
         {
         temp. read ((char *) this, sizeof(PASSANGER)) ;
         if ( temp.eof () )
         break ;
         file.write((char *) this, sizeof(PASSANGER)) ;
         }
         file.close() ;
         temp. close () ;
         }
         //---------------------------------------------------------------------------
         // THIS FUNCTION DELETES ALL PASSANGER RECORDS FOR THE GIVEN
         // FLIGHT NO.
         //---------------------------------------------------------------------------
         int PASSANGER :: DELETE_FLIGHT(int sno)
         {
         fstream file ;
         file.open("PASS.DAT", ios ::in|ios::binary) ;
         fstream temp ;
         temp.open("temp.dat", ios ::out|ios::binary) ;
         file.seekg(0,ios ::beg) ;
         int found = 0 ;
         while (!file.eof())
         {
   383   384   385   386   387   388   389   390   391   392   393