1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#include<iostream>
#include<string>
using namespace std;
class airport{
private:
int n;
string list[1000][3];
runway *run1,*run2;
public:
airport(){
run1 =new runway(1);
run2 =new runway(2);
}
void store(int n1,int i,string no1,string type1,string planned_time1){
n=n1;
list[i][0]=no1;
list[i][1]=type1;
list[i][2]=planned_time1;
}
string assign(int no,int i,int j){
return list[i][j];
}
int show(){
return n;
}
void print(airport &Airport){
run1.assign(Airport);
run2.assign(Airport);
run1.print;
run2.print;
}
};
class runway{
private:
int n; //number of flights
int no;
int y;// number of rows in runway
string list[1000][3];
public:
runway(int id){
no=id;
}
void assign(airport &Airport){
n=Airport.show();
y=0;
if(no==1)int i=0;
else int i=1;
for(int i;i<n;i+=2){
for(int k=0;k<3;k++){
list[y][k]=Airport.assign(no,i,k);
}
y++;
}
}
void print(){
cout<<"\nThe schedule of runway #"<<no<<": \n";
for(int i=0;i<y-1;i++){
for(int k=0;k<3;k++){
cout<<list[i][k]<<"\t";
}
}
}
};
class flight{
private:int n;string no,type,planned_time;
public:
flight(int n1,string no1,string type1,string planned_time1){
n=n1;
no=no1;
type=type1;
planned_time=planned_time1;
}
void assign(airport &Airport,int i){
Airport.store(n,i,no,type,planned_time);
}
};
int main(){
int n;
string no,type,planned_time;
airport air;
cout<<"Please input the number of flights in the timetable:\n";
cin>>n;
cout<<"Please input the detail of the flights:\n";
for(int i=0;i<n;i++){
cin>>no>>type>>planned_time;
flight setup(n,no,type,planned_time);
setup.assign(air,i);
}
air.print(air);
return 0;
}
|