Page 390 - C++
P. 390

break ;
         file.close() ;
         int i=1 ;
         file.open("TICKET.DAT", ios ::in|ios::binary);
         while (file.read((char *) this, sizeof(TICKET)))
         {
         if (slno == i)
         break ;
         i++ ;
         }
         file.close() ;
         PASSANGER p ;
         gotoxy(33,6) ;
         cout<< "Ticket no. "<<tno ;
         gotoxy(17,9) ;
         cout <<from <<" to "<<to ;
         gotoxy(45,9) ;
         cout<< "Flight no.  "<<fltno ;
         gotoxy(20,11) ;
         cout <<"Passanger Name:  "<<p.NAME(tno) ;
         gotoxy(20,13) ;
         cout <<"Address :  "<<address ;
         gotoxy(20,15) ;
         cout <<"Sex :  "<<sex ;
         gotoxy(20,17) ;
         cout <<"Age :  "<<age ;
         gotoxy(45,19) ;
         if (Class == 'E')
         cout <<"Total Fair:  "<<ecofair  ;
         else
         cout <<"Total Fair:  "<<exefair ;
         do
         {
         gotoxy(10,23) ; clreol() ;
         cout<< "Cancel this ticket (y/n) : " ;
         ch = getche() ;
         ch = toupper(ch) ;
         } while ( ch !=  'Y' && ch  !=  'N' ) ;
         if (ch == 'N')
         return ;
         DELETE_TICKET(tno) ;
         gotoxy(10,25) ;
         cout<< "\7 Ticket Cancelled" ;
         getch() ;
         }
         //---------------------------------------------------------------------------
         // THIS FUNCTION DISPLAY THE PASSANGER'S INFORMATION
         //---------------------------------------------------------------------------
         void RESERVE :: DISPLAY_TICKET(void)
         {
         clrscr() ;
         char t1[10] , ch ;
         int t2, tno, valid ;
         do
         {
         valid = 1 ;
         gotoxy(3,23) ; clreol() ;
         cout <<"PRESS <ENTER> TO SEE LIST or 0 TO EXIT" ;
         gotoxy(3,20) ;
         clreol() ;
         cout <<"Enter Ticket no. of the Passenger " ;
         gets (t1) ;
         t2 = atoi(t1) ;
         tno = t2 ;
   385   386   387   388   389   390   391   392   393   394   395