Anda di halaman 1dari 50

AIRLINES RESERVATION

PROJECT
SESSION:2009-2010

ARMY PUBLIC SCHOOL

NAME: PRATIK
KULSHRESTHA
AISSCE ROLL NO: 5673192
CLASS: XII SC. ‘A’

1
CONTENTS
SL NO. CONTENTS PAGE NO.
1. ACKNOWLEDGEMENT 2
2. INTRODUCTION 3
3. USER INTERFACE 5
4. TECHNICAL DESIGN 9
5. SOURCE CODE 17
6. OUTPUT 40
7. CERTIFICATE 48

2
ACKNOWLEDGEMENT

I would like to thank Mr. Debdutta Bakshi (PGT Comp.)

of Army Public School without whose support and

guidance it wouldn’t have been possible to complete this

project successfully. I would also like to thank the

authors of Comp Science with C++ ( Sumita Arora) and

The C++ Programming Language (Bjarne Stroustrup).

Lastly, my parents have been a great motivating factor

in my pursuance of excellence in creating a database fit

for Airlines.

3
INTRODUCTION
C++ (pronounced "See plus plus") is a statically typed, free-
form, multi-paradigm, compiled, general-purpose programming
language. It is regarded as a middle-level language, as it comprises a
combination of both high-level and low-level language features. It
was developed by a Bjarne stroustrup starting in 1979 at Bell Labs as
an enhancement to the C programming language and originally
named "C with Classes". It was renamed C++ in 1983.[2]
C++ is widely used in the software industry, and remains one of the
most popular languages ever created. Some of its application domains
include systems software, application software, device drivers,
embedded software, high-performance server and client applications,
and entertainment software such asvideo games. Several groups
provide both free and proprietary C++ compiler software, including
the GNU Project, Microsoft, Intel, Borland and others.
C++ is also used for hardware design, where design is initially
described in C++, then analyzed, architecturally constrained, and
scheduled to create a register transfer level hardware description
language via high-level synthesis.
The language began as enhancements to C, first adding classes,
then virtual functions, operator overloading, multiple
inheritance, templates, and exception handling among other features.
After years of development, the C++ programming language standard
was ratified in 1998 as ISO/IEC 14882:1998. That standard is still
current, but is amended by the 2003 technical corrigendum, SO/IEC
14882:2003. The next standard version (known informally as C++0x)
is in development.
In 1983, the name of the language was changed from C with
Classes to C++ (++ being the increment operator in C and C++).
New features were added including virtual functions, function name
and operator overloading, references, constants, user-controlled free-

4
store memory control, improved type checking, and BCPL style
single-line comments with two forward slashes (//).

The program written by me is for Airline Reservation Companies.


Airline Reservation System is a software which is used by the Airline
Department to facilitate online ticket booking. The reservation of the
seats include taking input for the number of seats, class of seat, day of
journey, destination, tariff and hence facilitates the reservation.

This software also helps in viewing the Airline Details, Adding New
Airline Details, Getting information about New Scheduled Flights,
Rescheduled Flights and Cancelled Flights under main subdivision
Reservation Details.
All in all the software provides robust and friendly environment for
the users to navigate through an airline ticket reservation.

5
USER INTERFACE
WELCOME TO
AIRLINE MANAGEMENT SOFTWARE

********** MAIN MENU **********


1. FLIGHT DETAILS
2.RESERVATION DETAILS
3. ENQUIRY
4. EXIT

6
********** FLIGHT DETAILS **********
1. ADD ENTRY
2. MODIFY ENTRY
3. DELETE ENTRY
4. VIEW ENTRY
5. GOTO MAIN MENU

ADD ENTRY
Flight No.:
Airlines Name:
Destination: From: To:
Day of Journey:
Time: Arrival: Departure:
No. of Seats: 1st Class: Economy Class:
Fare: 1st Class: Economy Class:

7
********** RESERVATION DETAILS *********
1. ADD RESERVATION
2. MODIFY RESERVATION
3. VIEW RESERVATION
4. GOTO MAIN MENU

ADD RESERVATION
PASSENGER DETAILS
Name:
Age:
Contact Address:
Contact Phone No.:
FLIGHT DETAILS
Flight No.:
Destination: From: To:
Class of Flights:
No. of Seats:
Fare:
Ticket No.:

8
********* ENQUIRY *********
1. Delhi
2. Chennai
3. Mumbai
4. Lucknow
5. Pune
6. Hyderabad
7. Aizawal
8. Jaipur
9. Goto Main Menu

9
TECHNICAL DESIGN
CLASS STRUCTURE
<class>
CLASS NAME
Class description and This class is used to store the
purpose records of various flights available
to the user. It contains flights
names, number, time, day, etc.

CLASS INHERITED NIL

CLASS USED NIL

10
ATTRIBUTE DATA TYPE

Destfrom,dest_to char
fname char
fno char
day char
seats1 int
seats2 int
fare1 float
fare2 float
arrival,departure char

<METHOD 1>

Method signature Modify_rentry()


Purpose Updates the number of seats when
cancelled
Scope of method Public

Return value void

<METHOD 2>
11
Method of signature view_entry()

Purpose Displays the various class and its


prices and other flight information

Return value void

<METHOD 3>

Method of signature view_entry()

Purpose Prints the ticket on the screen


Scope of method public

Return value void

<METHOD 4>

12
Method Signature add_entry()

Purpose Inputs the various data of class


flight.
Scope of method public

Return value void

<METHOD 5>

Method signature view_entry()

Purpose Displays the data of class flight.

Scope of method public

Return value void

<METHOD 6>

Method signature ret_seats1

13
Purpose Retuns the number of seats of
business class

Scope of method public

Return value int

<METHOD 7>

Method signature ret_seats2

Purpose Returns the number of seats of the


economy class.

Scope of method public


Return value int

<METHOD 8>

Method signature ret_fno

14
Purpose Returns the flight number

Scope of method public

Return value int

<METHOD 9>

Method signature ret_des()

Purpose Returns the destination

Scope of method public

Return value char

<METHOD 10>

Method signature ret_status()

Purpose Returns the status

Scope of method public


Return value char

<METHOD 11>

Method signature ret_day()

Purpose Returns the day

15
Scope of method public
Return value char
<STRUCTURE>

Structure name rec

Structure The structure is used to store the


records of the tickets sold
Description and purpose

Class or structure inherited Nil

Class or structure used Nil

Attribute Data type

Destfrom,dest_to char
fno char
day char
tkno int

FILE STRUCTURE

<File 1>:F_INFO.dat

Field Data type Length in bytes

16
Destfrom,dest_to char 15
fname char 25
fno char 6
day char 10
time int 2
seats1 int 2
seats2 int 2
fare1 float 4
fare2 float 4

<File 2>:Record.dat

Field Data type Length in bytes


Dest from,dest_to char 15
fno char 6
seats1,seats2 int 2
tkno int 8

SOURCE CODE
#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

#include<fstream.h>

17
class flight

int fno;

char fname[30];

char destfrom[30],dest_to[30];

char day[10];

char arrival[5],departure[5];

int seats1,seats2,seatsac;

float fare1,fare2,fareac;

public:

void flight_details();

void add_entry();

void modify_entry();

void del_entry();

void view_entry();

int ret()

{return fno;

}; // CLASS DECLARATION

void flight :: add_entry() // Function to add a flight entry

clrscr();

gotoxy(30,4);cout<<"ADD ENTRY";

gotoxy(5,7);cout<<"Flight No.:";cin>>fno;

gotoxy(5,9);cout<<"Air lines Name:";gets(fname);

gotoxy(5,11);cout<<"Destination:";

gotoxy(25,11);cout<<"From:";cin>>destfrom;

gotoxy(45,11);cout<<"To:";cin>>dest_to;

gotoxy(5,13);cout<<"Day Of Journey:";cin>>day;

18
gotoxy(5,15);cout<<"Time:";

gotoxy(25,15);cout<<"Arrival:";cin>>arrival;

gotoxy(45,15);cout<<"Departure:";cin>>departure;

gotoxy(5,17);cout<<"No. Of Seats:";

gotoxy(25,17);cout<<"1st Class:";cin>>seats1;

gotoxy(45,17);cout<<"Economy Class:";cin>>seats2;

gotoxy(5,19);cout<<"Fare:";

gotoxy(25,19);cout<<"1st Class:";cin>>fare1;

gotoxy(45,19);cout<<"Economy Class:";cin>>fare2;

gotoxy(5,21);cout<<"Press ENTER key to return to PLANE DETAILS MENU";

getch();

void flight :: modify_entry() // Function to modify an existing rntry

clrscr();

gotoxy(30,4);cout<<"MODIFY ENTRY";

gotoxy(5,7);cout<<"Flight Name:";gets(fname);

gotoxy(5,9);cout<<"Destination:";

gotoxy(25,9);cout<<"From:";cin>>destfrom;

gotoxy(45,9);cout<<"To:";cin>>dest_to;

gotoxy(5,11);cout<<"Day Of Journey:";cin>>day;

gotoxy(5,13);cout<<"Time:";

gotoxy(25,13);cout<<"Arrival:";cin>>arrival;

gotoxy(45,13);cout<<"Departure:";cin>>departure;

gotoxy(5,15);cout<<"No. Of Seats:";

gotoxy(25,15);cout<<"1st Class:";cin>>seats1;

gotoxy(45,15);cout<<"Economy Class:";cin>>seats2;

gotoxy(5,17);cout<<"Fare:";

gotoxy(25,17);cout<<"1st Class:";cin>>fare1;

19
gotoxy(45,17);cout<<"Economy Class:";cin>>fare2;

void flight :: del_entry() // Function to delete an existing entry

clrscr();

gotoxy(30,4);cout<<"DELETE ENTRY";

gotoxy(5,7);cout<<"Flight No.:";cout<<fno;

gotoxy(5,9);cout<<"Flight Name:";cout<<fname;

gotoxy(5,11);cout<<"Destination:";

gotoxy(25,11);cout<<"From:";cout<<destfrom;

gotoxy(45,11);cout<<"To:";cout<<dest_to;

gotoxy(5,13);cout<<"Day Of Journey:";cout<<day;

gotoxy(5,15);cout<<"Time:";

gotoxy(25,15);cout<<"Arrival:";cout<<arrival;

gotoxy(45,15);cout<<"Departure:";cout<<departure;

gotoxy(5,17);cout<<"No. Of Seats:";

gotoxy(25,17);cout<<"1st Class:";cout<<seats1;

gotoxy(45,17);cout<<"Economy Class:";cout<<seats2;

gotoxy(5,19);cout<<"Fare:";

gotoxy(25,19);cout<<"1st Class:";cout<<fare1;

gotoxy(45,19);cout<<"Economy Class:";cout<<fare2;

void flight :: view_entry() // Function to view entry

clrscr();

gotoxy(30,4);cout<<"VIEW ENTRY";

gotoxy(5,7);cout<<"Flight No.:";cout<<fno;

gotoxy(5,9);cout<<"Flight Name:";cout<<fname;

20
gotoxy(5,11);cout<<"Destination:";

gotoxy(25,11);cout<<"From:";cout<<destfrom;

gotoxy(45,11);cout<<"To:";cout<<dest_to;

gotoxy(5,13);cout<<"Day Of Journey:";cout<<day;

gotoxy(5,15);cout<<"Time:";

gotoxy(25,15);cout<<"Arrival;";cout<<arrival;

gotoxy(45,15);cout<<"Departure:";cout<<departure;

gotoxy(5,17);cout<<"No. Of Seats:";

gotoxy(25,17);cout<<"1st Class:";cout<<seats1;

gotoxy(45,17);cout<<"Economy Class:";cout<<seats2;

gotoxy(5,19);cout<<"Fare:";

gotoxy(25,19);cout<<"1st Class:";cout<<fare1;

gotoxy(45,19);cout<<"Economy Class:";cout<<fare2;

void add_fentry();

void modify_fentry();

void del_fentry();

void view_fentry();

void flight_main()

{int che;

do

do

clrscr();

gotoxy(18,5);cout<<"**********FIIGHT DETAILS**********";

gotoxy(25,7);cout<<"1.ADD ENTRY";

gotoxy(25,9);cout<<"2.MODIFY ENTRY";

21
gotoxy(25,11);cout<<"3.DELETE ENTRY";

gotoxy(25,13);cout<<"4.VIEW ENTRY";

gotoxy(25,15);cout<<"5.GOTO MAIN MENU";

gotoxy(25,17);cout<<"Enter Your Choice:";

gotoxy(43,17);cin>>che;

}while(che<1 && che>6);

switch(che)

{case 1:{

add_fentry();

break;

case 2:{

modify_fentry();

break;

case 3:{

del_fentry();

break;

case 4:{

view_fentry();

break;

}while(che>=1 && che<=4);

22
}

void add_fentry()

{fstream f;

f.open("flight2.dat",ios::app | ios::binary);

flight F;

if(!f)

{cout<<"\nFile not found";

exit(0);

F.add_entry();

f.write((char*)&F,sizeof(F)); //Write into the file

f.close();

void modify_fentry()

{fstream f,f1;

f.open("flight2.dat",ios::in | ios::binary);

flight F;

if(!f)

{cout<<"\nFile not found";

exit(0);

f1.open("temp.dat",ios::out | ios::binary);

int flighto;

char ans;

gotoxy(25,18);cout<<"\nEnter the flight number you want to modify:";

cin>>flighto;

f.read((char*)&F,sizeof(F));

while(!f.eof())

23
{

if(F.ret()!=flighto) //Checks for the required book

f1.write((char*)&F,sizeof(F));

else

{F.view_entry();

gotoxy(13,21);cout<<"\n Do you want to modify?";

cin>>ans;

if(ans=='Y' || ans=='y')

{F.modify_entry();

f1.write((char*)&F,sizeof(F)); //Modifies the record

else

f1.write((char*)&F,sizeof(F));

}f.read((char*)&F,sizeof(F));

f.close();

f1.close();

remove("flight2.dat");

rename("temp.dat","flight2.dat");

void del_fentry()

{fstream f,f1;

f.open("flight2.dat",ios::in | ios::binary);

flight F;

if(!f)

{cout<<"\n File not found";

exit(0);

f1.open("temp.dat",ios::out | ios::binary);

24
int flighto;

gotoxy(25,18);cout<<"\nEnter the flight no. to delete:";

cin>>flighto;

char ans;

f.seekg(0);

f.read((char*)&F,sizeof(F));

while(!f.eof())

if(F.ret()!=flighto) //Checks for the required book

f1.write((char*)&F,sizeof(F));

else

{F.view_entry();

gotoxy(4,21);cout<<"Do you want to delete?";

cin>>ans;

if(ans!='y' && ans!='Y')

f1.write((char*)&F,sizeof(F));

}f.read((char*)&F,sizeof(F));

f.close();

f1.close();

remove("flight2.dat");

rename("temp.dat","flight2.dat");

void view_fentry()

{fstream f;

f.open("flight2.dat",ios::in | ios::binary);

flight F;

if(!f)

{cout<<"\nFile not found";

25
exit(0);

f.seekg(0,ios::beg);

f.read((char*)&F,sizeof(F));

while(!f.eof())

F.view_entry();

getch();

f.read((char*)&F,sizeof(F));

f.close();

void delhi();

void chennai();

void mumbai();

void lucknow();

void pune();

void hyderabad();

void aizawl();

void jaipur();

void enqury_main()

{int che;

do

do

clrscr();

26
gotoxy(20,3);cout<<"********** ENQURY **********";

gotoxy(25,5);cout<<"1.DELHI";

gotoxy(25,7);cout<<"2.CHENNAI";

gotoxy(25,9);cout<<"3.MUMBAI";

gotoxy(25,11);cout<<"4.LUCKNOW";

gotoxy(25,13);cout<<"5.PUNE";

gotoxy(25,15);cout<<"6.HYDERABAD";

gotoxy(25,17);cout<<"7.AIZAWL";

gotoxy(25,19);cout<<"8.JAIPUR";

gotoxy(25,21);cout<<"9.GOTO MAIN MENU";

gotoxy(25,23);cout<<"Enter Your Choice:";

gotoxy(43,23);cin>>che;

}while(che<1 && che>10);

switch(che)

{case 1:{

delhi();

break;

case 2:{

chennai();

break;

case 3:{

mumbai();

break;

27
case 4:{

lucknow();

break;

case 5:{

pune();

break;

case 6:{

hyderabad();

break;

case 7:{

aizawl();

break;

case 8:{

jaipur();

break;

}while(che>=1 && che<=8);

void delhi()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

28
gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void chennai()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void mumbai()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

29
gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void lucknow()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void pune()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

30
gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void hyderabad()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void aizawl()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

31
gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

void jaipur()

{clrscr();

gotoxy(5,8);cout<<" ARRIVAL DEPARTURE";

gotoxy(5,9);cout<<"IC-263 07-00 DAILY IC-401 08-55 DAILY";

gotoxy(5,10);cout<<"9W-921 06-30 DAILY 9W-901 08-15 DAILY";

gotoxy(5,11);cout<<"9W-902 08-55 DAILY 9W-922 19-55 DAILY";

gotoxy(5,12);cout<<"IC-201 17-00 DAILY IC-202 20-05 DAILY";

gotoxy(5,13);cout<<"IC-402 18-45 DAILY IC-402 20-00 DAILY";

gotoxy(5,14);cout<<"S2-101 09-30 DAILY S2-109 11-30 DAILY";

gotoxy(5,15);cout<<"DN-402 11-45 DAILY DN-405 13-55 DAILY";

gotoxy(5,16);cout<<"S2-222 23-00 DAILY S2-221 06-05 DAILY";

gotoxy(5,17);cout<<"IT-608 11-05 DAILY IT-601 18-15 DAILY";

gotoxy(5,18);cout<<"S2-010 12-55 DAILY S2-110 13-45 DAILY";

getch();

class reserve

{private:

char name[20];

int age;

32
char sex;

char add[50];

long int phno;

int fno;

char fname[30];

char destfrom[30],dest_to[30];

char clas[10];

int seat;

float fare;

int tkno;

public:

void reservation();

void add_rentry();

void modify_rentry();

void view_rentry();

int retu()

{return tkno;

}; // CLASS DECLARATION

void reserve :: add_rentry() //member func of class

clrscr();

gotoxy(30,1);cout<<"ADD RESERVATION";

gotoxy(30,3);cout<<"PASSENGER DETAILS";

gotoxy(5,5);cout<<"Name:";gets(name);

gotoxy(5,6);cout<<"Age:";cin>>age;

gotoxy(5,7);cout<<"Contact Address:";gets(add);

33
gotoxy(5,8);cout<<"Contact Phone No:";cin>>phno;

gotoxy(30,10);cout<<"FLIGHT DETAILS";

gotoxy(5,12);cout<<"Flight No.:";cin>>fno;

gotoxy(5,14);cout<<"Destination:";

gotoxy(25,14);cout<<"From:";cin>>destfrom;

gotoxy(45,14);cout<<"To:";cin>>dest_to;

gotoxy(5,15);cout<<"Class of Flight:";cin>>clas;

gotoxy(5,16);cout<<"No. Of Seats:";cin>>seat;

gotoxy(5,17);cout<<"Fare:";cin>>fare;

gotoxy(5,18);cout<<"Ticket No:";cin>>tkno;

gotoxy(5,19);cout<<"Press ENTER key to return to RESERVATION DETAILS MENU";

getch();

void reserve :: modify_rentry() //member func of class

clrscr();

gotoxy(30,1);cout<<"MODIFY RESERVATION";

gotoxy(30,3);cout<<"PASSENGER DETAILS";

gotoxy(5,5);cout<<"Name:";gets(name);

gotoxy(5,6);cout<<"Age:";cin>>age;

gotoxy(5,7);cout<<"Contact Address:";cin>>add;

gotoxy(5,8);cout<<"Contact Phone No:";cin>>phno;

gotoxy(30,10);cout<<"FLIGHT DETAILS";

gotoxy(5,12);cout<<"Flight No.:";cin>>fno;

gotoxy(5,14);cout<<"Destination:";

gotoxy(25,14);cout<<"From:";cin>>destfrom;

gotoxy(45,14);cout<<"To:";cin>>dest_to;

gotoxy(5,15);cout<<"Class of Flight:";cin>>clas;

gotoxy(5,16);cout<<"No. Of Seats:";cin>>seat;

34
gotoxy(5,17);cout<<"Fare:";cin>>fare;

void reserve :: view_rentry() //member func of class

clrscr();

gotoxy(30,1);cout<<"VIEW RESERVATION";

gotoxy(30,3);cout<<"PASSENGER DETAILS";

gotoxy(5,5);cout<<"Name:";cout<<name;

gotoxy(5,6);cout<<"Age:";cout<<age;

gotoxy(5,7);cout<<"Contact Address:";cout<<add;

gotoxy(5,8);cout<<"Contact Phone No:";cout<<phno;

gotoxy(30,10);cout<<"FLIGHT DETAILS";

gotoxy(5,12);cout<<"Flight No.:";cout<<fno;

gotoxy(5,13);cout<<"Flight Name:";cout<<fname;

gotoxy(5,14);cout<<"Destination:";

gotoxy(25,14);cout<<"From:";cout<<destfrom;

gotoxy(45,14);cout<<"To:";cout<<dest_to;

gotoxy(5,15);cout<<"Class of Plane:";cout<<clas;

gotoxy(5,16);cout<<"No. Of Seats:";cout<<seat;

gotoxy(5,17);cout<<"Fare:";cout<<fare;

gotoxy(5,18);cout<<"Ticket No:";cout<<tkno;

void add_record();

void modify_record();

void view_record();

void reservation_main()

{int ch;

35
do

do

clrscr();

gotoxy(18,5);cout<<"********** RESERVATION DETAILS **********";

gotoxy(25,7);cout<<"1.ADD RESERVATION";

gotoxy(25,9);cout<<"2.MODIFY RESERVATION";

gotoxy(25,11);cout<<"3.VIEW RESERVATION";

gotoxy(25,13);cout<<"4.GOTO MAIN MENU";

gotoxy(25,15);cout<<"Enter Your Choice:";

gotoxy(43,15);cin>>ch;

}while(ch<1 && ch>4);

switch(ch)

{case 1:{

add_record();

break;

case 2:{

modify_record();

break;

case 3:{

view_record();

break;

36
}while(ch>=1 && ch<=3);

void add_record()

{fstream f;

f.open("reserve1.dat",ios::app | ios::binary);

reserve R;

if(!f)

{cout<<"\nFile not found";

exit(0);

R.add_rentry();

f.write((char*)&R,sizeof(R)); //Write into the file

f.close();

void modify_record()

{fstream f,f1;

f.open("reserve1.dat",ios::in | ios::binary);

reserve R;

if(!f)

{cout<<"\nFile not found";

exit(0);

f1.open("temp.dat",ios::out | ios::binary);

int ticno;

char ans;

gotoxy(5,16);cout<<"\nEnter the ticket number you want to modify:";

37
cin>>ticno;

f.read((char*)&R,sizeof(R));

while(!f.eof())

{if(R.retu()!=ticno) //Checks for the required book

f1.write((char*)&R,sizeof(R));

else

{R.view_rentry();

gotoxy(5,19);cout<<"\n Do you want to modify?";

cin>>ans;

if(ans=='Y' || ans=='y')

{R.modify_rentry();

f1.write((char*)&R,sizeof(R)); //Modifies the record

else

f1.write((char*)&R,sizeof(R));

f.read((char*)&R,sizeof(R));

f.close();

f1.close();

remove("reserve1.dat");

rename("temp.dat","reserve1.dat");

void view_record()

{fstream f;

f.open("reserve1.dat",ios::in | ios::binary);

reserve R;

if(!f)

38
{cout<<"\nFile not found\n";

exit(0);

f.seekg(0,ios::beg);

f.read((char*)&R,sizeof(R));

while(!f.eof())

R.view_rentry();

getch();

f.read((char*)&R,sizeof(R));

f.close();

void main()

{clrscr();

gotoxy(34,10);cout<<"WELCOME TO";

gotoxy(26,13);cout<<"AIRLINE MANAGEMENT SOFTWARE";

gotoxy(1,21);cout<<"Press any key to continue";

getch();

int ch;

do{

do{

clrscr();

gotoxy(20,1);cout<<"********** MAIN MENU **********";

gotoxy(25,5);cout<<"1.FLIGHT DETAILS";

gotoxy(25,7);cout<<"2.RESERVATION DETAILS";

gotoxy(25,9);cout<<"3.ENQURY";

gotoxy(25,11);cout<<"4.EXIT";

gotoxy(25,13);cout<<"Enter Your Choice: ";

39
gotoxy(43,13);cin>>ch;

}while(ch<0 && ch>5);

switch(ch)

case 1: { flight_main();

break; }

case 2: { reservation_main();

break; }

case 3:{ enqury_main();

break; }

case 4: {clrscr(); gotoxy(31,8);cout<<"THANK YOU";

gotoxy(31,10);cout<<"FOR USING";

gotoxy(23,13);cout<<"AIRLINE MANAGEMENT SOFTWARE";

exit(0);

break;

}while(ch>=0 && ch<5);

OUTPUT

40
41
42
43
44
45
46
47
48
CERTIFICATE

This is to certify that Roll No. 5673193 of Army Public School,


Kolkata has successfully completed the project on Computer Science
in C++ for CBSE year 2009-2010.

___________ ______ ________


(Computer Teacher) (Principal) (Invilgilator)

49
50