Sherwin R. Soriano Emil Noeh Gumabon Bsit-2B

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Sherwin R.

Soriano

Emil Noeh Gumabon

BSIT-2B

FLIGHT BOOKING SYSTEM

BODY:

• C Program

• Array variable and using for this are:

- flight = this will source for destination countries

- ticket = to know how many ticket did you get and how much the ticket do you have

INTRODUCTION:

• Flight booking reservation

• Ojectives

- this program is created for booking for 3 countries with 10 person the fare minimum is 1000 and
maximum is 5000.

PROGRAM:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

void header()

printf("\nFlight Price Seating Capacity Available Seats\n");

void option1()

printf("\nFlight Price Seating Capacity Available Seats\n");

printf("1. Manila To Hong Kong 1,500 100 16\n");

printf("2. Manila To Caticlan 1,000 75 0\n");


printf("3. Manila To Singapore 3,000 100 24\n");

void option2()

printf("\nFlight Price Seating Capacity Available Seats\n");

printf(“1. Manila To Hong Kong 1,700 100 18\n");

printf(“2. Manila To Caticlan 2,000 75 24\n");

printf(“3. Manila To Singapore 4,000 100 65\n");

void option3()

printf("\n Flight Price Seating Capacity Available Seats\n");

printf(“1. Manila To Hong Kong 2,000 100 46\n");

printf(“2. Manila To Caticlan 1,500 75 16\n");

printf(“3. Manila To Singapore 4,000 100 85\n");

int choice()

struct flight{

int ticket;

};

int main() {

struct flight book[10];

char user[50], pw[50], adminu[50]="noeh", adminpw[50]="gumabon";

int trip, date, date2, a, x, y;

float total;

char repeat;
printf("\nEnter username: ");

scanf("%s", &user);

printf("\nEnter password: ");

scanf("%s", &pw);

if (strcmp(user, adminu)==0 && strcmp(pw, adminpw)==0)

printf("\nWelcome");

printf("\nChoose if one way trip or roundtrip: ");

printf("\n1. One way trip \n2. Roundtrip\n");

scanf("\n%d", &trip);

printf("\nDate: ");

printf("\n1. Nov 1, 2019 \n2. Nov 2, 2019 \n3. Nov 3, 2019(not applicable for round trip)\n");

scanf("%d", &date);

switch (trip)

case 1:

if (date==1)

printf("\nNov 1, 2019\n");

option1();

printf("\nHow many tickets will you get?:");

scanf("%d", &x);

for (a=1; a<=x; a++)

printf("\nPlease select which flight you will book: ");

scanf("%d", &book[a].ticket);

}
else if (date==2)

printf("\nNov 2, 2019\n");

option2();

printf("\nHow many tickets will you get?: ");

scanf("%d", &x);

for (a=1; a<=x; a++)

break;

break;

default:

break;

printf("\n");

printf("\nSummary: ");

for (a=1; a<=x; a++)

printf("\nDetails of Ticket no. [%d]", a);

printf("\nFlight no. [%d]\n", book[a].ticket);

printf("Manila to Hong Kong total price: 2,000+100+45 = 2,145\n",x);

printf("Manila To Caticlan total price: 1,500+75+16 = 1,596\n",x);

printf("Manila To Singapore total price: 4,000+100+65 = 4,165\n",x);

printf("\nTotal number of tickets: %d\n", x);

else

{
printf("\nInvalid login");

return 0;

Refference:https://www.daniweb.com/programming/software-development/threads/509427/flight-
reservation-in-c-program

You might also like