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

Ancient Dragon commented: post code correct on very first post :) +14

PLease help me in adding files to this code is it very simple for

What exactly is your question? What compiler? what operaring system? WWat do you want the files to contain? Please explain your needs in greater detail.

Is it airline reservation homework time of year already? Oh, how the year flew by. :D

I'm going to go out on a limb and say the OP is asking for help in adding the ability to save data to and recall data from a file.
Also, it seems the OP copy and pasted the code 7 times.
To the OP's credit, the code was posted properly which is not always common for first-time posters.

That seems a reasonable assumption, though I'd want to hear back from the OP before assuming that this is what is needed. In the meanwhile, here are some comments I cann make based on the code itself:

  • You included the <iostream> header for the C++ style I/O, but used C style I/O throughout the program. While this isn't a problem in and of itself, you would want to #include <cstdio> instead of <iostream> if that is how you wish to write the program.
  • You use system("cls"); for clearing the console. While this isn't a very good approach (as explained here in detail), that's not what I wanted to mention. The system() function is part of the standard C library, and you should #include <cstdlib> if you are going to use it at all - but really, you don't want to do it this way, trust me. The link given above lists the alternatives for clearing the console under both Windows and Unix.
  • On a similar note, to use strcpy(), you need to #include <cstring>.
  • OTOH, you aren't using anything that requires <windows.h>, and you can safely remove it from the list of includes.
  • You use <conio.h> for the getch() function. the conio libary is not standard, and using it is generally discouraged.
  • The line

    int const = 20;

is incomplete, and should cause a compile-time error. You need to have an identifier in there after const, otherwise it's a syntax error.

  • You don't have a default case for the switch() statement, which could cause the program to hang while waiting for valid input. You may want to add the following:

        default:
            printf("\nThat is not one of the options given.\n");
            getch();
            break;
    
  • The initializer for seats[][] is incorrect; you should use

    int seats[5][4] = {{0, 0, 0, 0},
    {0, 0, 0, 0},
    {0, 0, 0, 0},
    {0, 0, 0, 0},
    {0, 0, 0, 0}};

This ensures that all of the elements gets correctly initialized.

  • Stylistically, you would do well to break the individual cases out into separate functions; this would make the whole program much more readable.
  • fflush(stdin) does not have the effect you are trying to get, at least not consistently. Strictly speaking, applying fflush() to an input stream is Undefined Bahavior, and relying on it to behave in a particular way is non-portable, even between different compilers on the same system.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.