PLease help me in adding files to this code is it very simple for
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
struct flight_date
{
int day;
int month;
int year;
};
struct flight_time
{
int hours;
int minutes;
};
struct BookingInfo
{
flight_date date;
flight_time time;
char location[20];
char destination[20];
char person_name[20];
char gate_no[3];
char flight_num[5];
int no_of_seats;
int seats_booked[20];
}B[20];
int const = 20;
int reserved = 0;
int empty = 20;
int seats[5][4] = {0};
int current_bookings = 0;
int main()
{
bool b=1;
while(b)
{
system("cls");
printf (" ------ Airline Reservation Menu ------\n\n\n");
printf("Press 1 for Booking\n");
printf("Press 2 to Display Seat Layout & Occupancy\n");
printf("Press 3 to exit");
char input;
input = getch();
switch(input)
{
case '1':
system("cls");
printf("Enter no of Seats to book: \n");
int required_seats;
scanf("%d" ,&required_seats);
if (required_seats > empty)
{
printf("Not enough seats available!\n");
getch();
}
else
{
system("cls");
fflush(stdin);
printf("Please enter your name: ");
gets(B[current_bookings].person_name);
printf("Please enter your starting location: ");
gets(B[current_bookings].location);
printf("Please enter your Destination: ");
gets(B[current_bookings].destination);
// B[current_bookings].date.day = 11;
printf("Enter Date of Flight: ");
scanf("%d" , &B[current_bookings].date.day);
// B[current_bookings].date.month = 9;
printf("Enter Month of Flight (in digits): ");
scanf("%d" , &B[current_bookings].date.month);
B[current_bookings].date.year = 2012;
// B[current_bookings].time.hours = 8;
printf("Enter Time of Flight (hours): ");
scanf("%d" , &B[current_bookings].time.hours);
// B[current_bookings].time.minutes = 45;
printf("Enter Time of Flight (minutes): ");
scanf("%d" , &B[current_bookings].time.minutes);
// strcpy(B[current_bookings].location, "Lahore");
// strcpy(B[current_bookings].destination, "Karachi");
strcpy(B[current_bookings].flight_num, "FH32");
strcpy(B[current_bookings].gate_no, "G9");
B[current_bookings].no_of_seats = required_seats;
int count=0;
int seat_no=0,k=0;
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
seat_no++;
if (seats[i][j] == 0)
{
seats[i][j] = 1;
B[current_bookings].seats_booked[k++] = seat_no;
count++;
}
if (count >= required_seats)
i=5;
}
}
printf("\nBookings are successful!\n");
printf("Your Booking information is as follows:-\n\n");
printf("Customer Name: ");
puts(B[current_bookings].person_name);
printf("Flight Date: %d/%d/%d\n" , B[current_bookings].date.day,B[current_bookings].date.month,B[current_bookings].date.year);
printf("Flight Departure Time: %d:%d am\n" , B[current_bookings].time.hours,B[current_bookings].time.minutes);
printf("Flight No: %s\n" , B[current_bookings].flight_num);
printf("Gate No: %s\n" , B[current_bookings].gate_no);
printf("Departure from: %s\n" , B[current_bookings].location);
printf("Destination: %s\n" , B[current_bookings].destination);
printf("Your Seat Numbers are: ");
for (int i=0; i<B[current_bookings].no_of_seats; i++)
{
printf("%d , " , B[current_bookings].seats_booked[i]);
}
printf("\n");
reserved = required_seats;
empty -= required_seats;
current_bookings++;
getch();
}
break;
case '2':
system("cls");
for (int i=0; i<5; i++)
{
for (int j=0; j<4; j++)
{
printf("%d\t" , seats[i][j]);
}
printf("\n");
}
printf("\n\n0 represents empty seats\n1 represents reserved seats\n");
getch();
break;
case '3':
system("cls");
printf("Thankyou for using this program!\n");
getch();
b = 0;
break;
};
}
}
online airline reservartion system