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
|
#include<iostream>
#include<string>
using namespace std;
class airport{
private:int n;string list[1000][3];
public:
class runway{
private:
int n;
int no;
string list[1000][3];
public:
runway(int id){
no=id;
}
int showid(){
return no; }
void print(airport Airport){
n=Airport.show();
cout<<"The schedule of runway #"<<n<<": ";
if(no==1){
for(int i=0;i<n;i+=2){
for(int k=0;k<3;k++){
cout<<Airport.list[i][k];
}
}
}
else if(no==2){
for(int i=1;i<n;i+=2){
for(int k=0;k<3;k++){
cout<<Airport.list[i][k];
}
}
}
}
};
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;
}
int show(){
return n;
}
void print(airport Airport){
runway run1(1),run2(2);
run1.print(Airport);
run2.print(Airport);
}
};
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;
}
|