100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
]#include <iostream>
#include <string>
#include <ctime>
using namespace std;
int option(int hours,int mins)
{
int option;
if(hours>=15)
{
cout <<"sorry its too late to make any bookings today!"<<endl;
<<"Please come back tomorrow."<<endl<<endl<<endl;
system ("pause");
return 0;
}
if (hours==9&&mins>=30)(hours>9&&hours<15)(hours==15&&mins<30))
{
cout<<"\n Flight FL620 available will depart at 16:00"<<endl
cin>>endl;
return 0;
}
if hours<=9)
{
cout<<"\nYou have two flights available"<<endl
<<"FL600 departing at 10:00....FL620 departing at 16:00"<<endl
<<"\choose a flight:"<<endl
<<"press '1' for FL600."<<endl
<<"press '2' for FL620."<<endl;
cin>>option;
if (option=='1')
{cout<<"\You have chosen flight FL600"<<endl;]\}
if (option == '2')
{cout<<"\n You have chosen flight FL620"<<endl;}
return option;
}
}
int rows =4;
int columns=5;
size=20;
char seat[rows] [columns]
int main()
{
for (int i=0;i<5;i++)
for (int j=0;i<4;i++)
seat [i][j]="o";
}
void menu()
{
cout<<"welcome to northern airlines\n";
cout<<"please enter one of the following\n";
cout<<" 1. First Class\n";
cout<<" 2. Business Class\n";
cout<<" 3. Economy Class\n";
cin>>menu;
return menu;
}
string seats
{
seats[20]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"};
string seats;
options
{
1.
cout<<"\n\n\t**First Class**"<<endl
<<"\t-------"<<endl<<endl;
cout<<"seats available:\n\n\t";
for (int i=0;i<5;i++)
cout<<seat(4)<<seats[i]
cout<<"\n\n Choose your seat:"endl
<<"(eg:1,3)\n";
cin>>seat
break;
2.
cout<<"\n\n\t** Business Class**"<<endl
<<"t------"<<endl<<endl;
cout<<"Seats Available:\n\n\t;
for (int i=5;i<10;i++)
cout<<seats(4)seats[i];
cout<<"\n\n Please choose your seat:"<<endl
<<"(eg.7,9)\n";
cin>>seat;
break;
3.
cout<<"\n\n\t**Economy Class**"<<endl
<<"\
|
cout<<Seats available:\n\n\t";
for (int i=10;i<20<i++)
cout<<seats(4)<<seats[i];
cout<<"\n\n Please choose a seat:"<<endl
<<"(eg. 12,15)\n";
cin>>seat;
}
return seat;
}
float get_charge
{
float charge;
if(option1==1)
{charge=800.00;}
if(option1==2)
{charge=400.00;}
if(option1==3)
{charge=600;}
return charge;
}
string travel(int option1)
{
string type;
if(option 1==1)
{type="First";}
if(option 1==2)
{type = "Business";}
if(option 1==3)
{type ="Econom";}
return type;
}
void print_Boarding_Pass
{
cout<<"\t "<<endl
<<"\t Boarding Pass"<<endl
<<"\t Passenger Name: "name<<.<<endl<<endl
<<"\t Seat Number: "<<seat<<.<<endl<<endl
<<"t Class: "<<type<<"Class."<<endl<<endl
<<"\t Flight Charge: " <<"$"<<charge<<".00"<<"endl;
if ((hours == 9&&mins>=30) (hours>9&&hours<15) (hours==15&&mins<30))
{cout<<"n\n>Please Note:Flight leaves at 16:00."endl
<<" Reporting Time is 15:30!\n\n\n";
}
if(hours<9&&option==2)
{
cout<<"\n\n>Please Note:Flight leaves at 10:00."<<endl
<<" Reporting Time is 09:30!n\n\n";
}
}
int main()
{
int hours,mins,option1;
string name,seat,type,First,Business,Economy;
float charge;
cout<<"t*************";
cout<<"\n\t Welcome To Northern Airlines"<<endl
<<"t*************";
cout<<"\n\n To reserve your seat"<<endl
<<"Please enter your name:";
getline(cin,name);
cout<<"\n Please enter current time as follows:"<<endl
<<"hours:";
cin>>hours;
cout<<"minutes:";
cin>>mins;
option=get_option(hours,mins);
option1=flight(option);
system("cls");
seat= seats (option1);
type=travel(option1);
charge=get_charge(option1);
system("cls");
if(hours<=15)
{
Print_Boarding_Pass(name,seat,type,charge,hours,mins,option);
}
system ("pause")
return 0;
} |