Page 463 - C++
P. 463
Airline Reservation
A project to store record of flights, their fare and to generate tickets
struct Seat
{
int total_seats,seat_bkd;
char Type;
float Rate;
};
struct date
{
int dd,mm,yy;
};
class Flight
{
int Plane_no;
char Starting_place[30],Destination[30];
Seat s[2];
public:
void FGetdata();
void FDisplaydate();
int Return_flightno{ return Flight_no; }
char *Return_Starting_place() { return Starting_place; }
char *Return_Destination() { return Destination; }
};
class Flight_Dep
{
int flight_no;
date Flight_date;
int hr,min;
int Plane_no;
Seat s[2];
public:
void FDGetdata();
void FDDisplaydate();
int Return_flightno{ return Flight_no; }
int Check_seat(char t)
{
if (s[0].Type == t && s[0].seat_bkd < s[0].total_seat)
return 1;
else if(s[1].Type = = t && s[1].seat_bk < s[1].total_seat)
return 1;
else
return 0;
}
void Update_seat(char t)
{
if (s[0].Type = = T)
s[0].seat_bkd++;
else if(s[1].Type = = T)
s[1].seat_bkd++;
}
};