Page 383 - C++
P. 383

valid = 0 ;
         gotoxy(3,23) ;
         cout<<"                                            " ;
         gotoxy(3,23) ;
         cout<<"\7 ENTER CORRECTLY" ;
         getch() ;
         }
         } while (!valid) ;
         int i=1 ;
         fstream file ;
         file.open("TICKET.DAT", ios :: in|ios::binary) ;
         while (file.read((char *) this, sizeof(TICKET)))
         {
         if (sno == i)
         break ;
         i++ ;
         }
         file.close() ;
         strcpy(pfltno,fltno) ;
         if (p.SEATS(sno) >= 250)
         {
         gotoxy(5,21) ;
         cout<<"\7 Sorry! Seats are not available." ;
         getch() ;
         return ;
         }
         gotoxy(3,23) ;
         cout<<"                                                       " ;
         gotoxy(3,23);
         cout<< "E=ECONOMIC, X=EXECUTIVE or PRESS <ENTER> TO EXIT" ;
         do
         {
         gotoxy(3,21);
         cout <<"                                                   " ;
         gotoxy(3,21) ;
         cout<<"By which Class you want to travel: " ;
         pclass = getche() ;
         pclass = toupper(pclass);
         if (pclass == 13)
         return ;
         } while (pclass != 'E' && pclass != 'X') ;
         clrscr() ;
         gotoxy(72,3) ;
         cout <<"<0>=EXIT" ;
         gotoxy(34,2) ;
         cout<<"RESERVATION" ;
         gotoxy(5,5) ;
         cout<<"NAME: " ;
         gotoxy(5,6) ;
         cout<<"ADDRESS: " ;
         gotoxy(5,7) ;
         cout<<"SEX M/F : " ;
         gotoxy(5,8) ;
         cout<<"AGE: " ;
         do
         {
         valid = 1 ;
         gotoxy(5,25) ; clreol() ;
         cout<<"ENTER NAME OF THE PASSANGER" ;
         gotoxy(15,5);clreol() ;
         gets(pname);
         if (pname [0] == '0' )
         return ;
         if (strlen(pname) < 1 || strlen(pname) > 25)
   378   379   380   381   382   383   384   385   386   387   388