program in c++ for airline reservation
Answers
Answered by
1
#include <iostream>
#include <vector>
class Record
{
private:
struct Flight
{
string FlightNo;
int seats;
}
struct Passenger
{
string Name;
string PhoneNumber;
string FlightNum;
string Date;
}
vector<Flight> FList;
vector<Passenger> PList;
public:
void NewFlight(string FN, int seats)
{
for(int i =0; i<FList.size(); i++)
{
if(FN.strcmp(FList[i].FlightNo))
{
cout << "Flight already exists" << endl;
return;
}
}
Flight Addition = new Flight; // create new struct
Addition.FlightNo = FN;
Addition.seats = seats;
FList.push_back(Addition);
return;
}
void add(string Name, string PhoneNumber, string FlightNum, string Date)
// go through passenger list to check name and make sure reservation does not exist
// go through flight and when find flight list check if seats are available. If nothing found, print "no flight exists"
// otherwise, add object to passenger list
using namespace std;
int main()
Similar questions