Flight Management System
Flight Management System
#include<iostream>
#include<string>
using namespace std;
struct Flight
{
string fnum;
int fuel;
int hours;
int minutes;
int passengers;
string city;
string destination_city;
int average_time;
};
class Flight_Management_System
{
private:
Flight LaQ1[20];
int LaQC1;
int counter;
Flight TaQ1[20];
int TaQC1,TaQC2;
int ET_QC1,ETQC2;
public:
Flight_Management_System()
{
counter=0;
}
// landing flight queue
LaQ1_flight( Flight frecord)
{
LaQ1[counter].fnum=frecord.fnum;
LaQ1[counter].fuel=frecord.fuel;
LaQ1[counter].hours=frecord.hours;
LaQ1[counter].minutes=frecord.minutes;
LaQ1[counter].city=frecord.city;
counter++;
}
void TaQ_flight( )
{
if(TaQ1isempty()==false)
{
int a=TaQ1[TaQC2];
for(int i=TaQC2;i<TaQC1;i++)
{
TaQ1[i]= TaQ1[i+1];
}
}
counter--; TaQC1--;
return a;
}
void EL_flight()
{
for(int i; i<=counter;i++)
{
if(LQ1[i].fuel< 1000)
{
cout<<" Emergency landing "<<LQ1[i].fnum;
}
}
}
void ET_flight()
{
int b=TaQ1[ET_QC1];
for(int i=ET_QC2;i<ET_QC1;i++)
{
TaQ1[i]= TaQ1[i+1];
}
}
counter--; ET_QC1--;
return b;
}
bool LaQ1isfull()
{
if(LaQC1>=20)
{
return true;
}
else
{
return false;
}
}
bool TaQ1isempty()
{
if(TaQC1<=0)
{
return true;
}
else
{
return false;
}
}
void view()
{
for(int i=0;i<counter;i++)
{
cout<<LaQ1[i].fnum;
}
}
};
int main()
{
Flight_Management_System FMS;
int choice;
string fnum,city;
int fuel,hours,minutes, passengers;
Flight frecord;
string destination_city;
while(choice!=0)
{
cout<<"\n\n\t Press 1 To : Land ";
cout<<"\n\n\t Press 2 To : Take off ";
cout<<"\n\n\t Press 3 To : Emergency Land ";
cout<<"\n\n\t Press 4 To : Emergency Take off ";
cout<<"\n\n\t Press 5 To : View reports ";
cout<<"\n\n\t Enter your Choice";
cin>>choice;
switch(choice)
{
case 1:
if(FMS.LaQ1_flight(frecord))
{
if(FMS.LaQ1isfull()==false)
}
return 0;
}