0% found this document useful (0 votes)
69 views52 pages

Railway Reservation System Project

This project document describes a railway reservation system created by three students. The system allows users to search for train availability, view schedules and fares, and book tickets using debit/credit cards. It also includes the ability to cancel booked tickets. The project was submitted to fulfill a class requirement and includes sections on C++ features, object-oriented programming concepts, project objectives and description, code, outputs, and limitations.

Uploaded by

Fun wiTh TecH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views52 pages

Railway Reservation System Project

This project document describes a railway reservation system created by three students. The system allows users to search for train availability, view schedules and fares, and book tickets using debit/credit cards. It also includes the ability to cancel booked tickets. The project was submitted to fulfill a class requirement and includes sections on C++ features, object-oriented programming concepts, project objectives and description, code, outputs, and limitations.

Uploaded by

Fun wiTh TecH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

12 CS PROJECT

K-3, MOHAN GARDEN, UTTAM NAGAR, NEW DELHI-110059

COMPUTER INVESTIGATORY PROJECT


ON
“RAILWAY RESERVATION SYSTEM”

SUBMITTED TO SUBMITTED BY
MS. KIRTI KUMAR (PGT) ABHINANDAN PANDEY
AMIT JHA
ROSHAN PRASAD
12 CS PROJECT

“RAILWAY RESERVATION SYSTEM”


PROJECT REPORT
In Partial fulfilment of the requirements
For the award of the Class of
COMPUTER
Submitted By
Abhinandan Pandey XII-Science,
Amit Jha XII-Science,
Roshan Prasad XII-Science.
UNDER THE GUIDANCE OF
MS. KIRTI KUMAR, PGT
CBSE AISSCE 2018-19

R. P. MEMORIAL SR. SEC. PUBLIC SCHOOL


K-3, MOHAN GARDEN, UTTAM NAGAR, NEW DELHI-110059
12 CS PROJECT

TABLE OF CONTENTSTOPIC
Introduction to C++
Features of OOP
Types of Inheritance
Introduction to Project
Objective of Project
Description of Project
Coding
Outputs
Compilation Report
Limitations
Bibliography
12 CS PROJECT

CERTIFICATE

This is to certify that the project entitled “RAILWAY


RESERVATION SYSTEM”is a record of Bona fide work
carried out by “Abhinandan Pandey XII-Science, AmitJha
XII-Science, Roshan Prasad XII-Science”. In partial
fulfilment of the requirements in COMPUTER prescribed by
CBSE AISSCE 2018-19 in the school R. P. Memorial Sr. Sec.
Public School, K-3 Mohan Garden, Uttam Nagar, New Delhi-
110059.
DATE: - PRINCIPAL

INTERNAL EXAMINER EXTERNAL EXAMINER


12 CS PROJECT

DECLARATION

We do hereby declare that the project work entitled


“RAILWAY RESERVATION SYSTEM”

Submitted to “R. P. MEMORIAL [Link]. PUBLIC


SCHOOL” for the Subject of “COMPUTER”.

Under the guidance of “MS. KIRTI KUMAR, PGT” Is


a record of original work done by us.
We further declare that this project record or any part of
this has not been submitted elsewhere for any other class.
12 CS PROJECT

ACKNOWLEDGEMENT

We wish to express our sincere thanks to “MRS.


SUNITA YADAV (PRINCIPAL)”, R. P. Memorial Sr.
Sec. Public School for guiding us to cause the successful
outcome of this project work.

We wish to express our deep & profound sense of


gratitude to our guide teacher “MS. KIRTI KUMAR,
PGT”, for her expert help & valuable guidance,
comments and suggestions.

We also place on record, our sincere gratitude to one and


all who, directly or indirectly, have their helping hand in
this venture.
12 CS PROJECT
12 CS PROJECT

INTRODUCTION TO C++
C++ is a programming Language Developed by
BjarneStroustrup. It was originally named as C with classes, was
renamed as C++ in 1983. It is regarded as an intermediate-level
language, as it comprises both high-level and low-level language
features. It’s application domains include systems software,
application software, device drivers, embedded software, high-
performance server and client applications, and entertainment
software such as video games. C++ continues to be used and is
one of the preferred programming language to develop
professional applications.

The Features of C++ as a Language:-


Now that all the necessary theory has been covered, now it is
possible to explain what C++ has to offer as a programming
language. C++…..

. …is an open source ISO-standardized language.


For a time, C++ has no official standard and was maintained by
a defects standard, however since 1998, C++ is standardized by
a committee of the ISO.

. …is a compiled language.


12 CS PROJECT

C++ compiles directly to a machine’s native cord, allowing it to


be one of the fastest languages in the world, if optimized.

. …supports both static and dynamic type checking.


C++ allows type conversions to be checked either at compile-
time or at run-time, again offering another degree of flexibility.
Most C++ type checking is, however, static.

. …is portable.
As one of the most frequently used language in the world and as
an open language, C++ has a wide range of compilers that run
on many different platforms that support it. Code that
exclusively uses C++’s standard library will run on many
platforms with few to no changes.
12 CS PROJECT
12 CS PROJECT

FEATURES OF OOP

1. Objects
2. Classes
3. Member Functions
4. Reusability
5. Data Abstraction
6. Data Encapsulation
7. Polymorphism
8. Overloading
9. Inheritance

Classes:-
Classes are data types based on which objects are created.
Objects with similar properties and methods are grouped
together to form a Class. Thus, a Class represents a set of
individual objects. Characteristics of an object are represented
in a Class as Properties. The actions that can be performed by
objects become functions of the class and are referred to as
Methods. No memory is allocated when a class is created.
Memory is allocated only when an object is created, i.e., when
an instance of a class is created.
12 CS PROJECT

Member functions:-
These are functions which are considered part of the object
and are declared in the class definition. They are often
referred to as methods of the class. In addition to member
functions, a class’s behaviour is also defined by:
What to do when you create a new object (the constructor for
that object)-in other words, initialize the object’s data.
What to do when you delete an object (the destructor for that
object).
Private vs. Public members:-A public member of a class is
one that can be read or written by anybody in the case of a
data member, or called by anybody in the case of a member
function. A private member can only be read, written or called
by a member function of that class.
Reusability:-
This term refers to the ability for multiple programmers to use
the same written and debugged existing class of data. This is a
time-saving device and adds code efficiently to the language.
Additionally, the programmer can incorporate new features to
the existing class, further developing the application and
allowing user to achieve increased performance. This time-
saving feature optimizes code, helps in gaining secured
applications and facilities easier maintenance of the
application.
12 CS PROJECT

Data Abstraction:-
Data Abstraction increases the power of programming
language by creating user-defined data types. Data
Abstraction also represents the needed information in the
program without presenting the details.

Data Encapsulation:-
Data Encapsulation combines data and functions into a single
unit called class. When using Data Encapsulation, data is not
accessed directly; it is only accessible through the functions
present inside the class. Data Encapsulation enables the
important concept of data hiding.

Polymorphism:-
Polymorphism allows routines to use variables of different
types at different times. An operator or function can be given
different meanings or functions. Polymorphism refers to a
single function or multifunctioning operator performing in
different ways.
12 CS PROJECT

Overloading:-
Overloading is one type of Polymorphism. It allows an object
to have different meanings, depending on its context. When
an existing operator or functions begins to operate on new
data type or class, it is understood to be overloaded.
Inheritance:-
Inheritance is the process of forming a new class from an
existing class or base class. The base class is also known as
parent class or super class. The new class that is formed is
called derived class. Derived class is also known as a child or
sub class. Inheritance helps in reducing the overall code size
of the program, which is an important concept in Object
Oriented Programming.
There are 5 types of Inheritance:

 Single inheritance
 Multilevel Inheritance
 Multiple Inheritance
 Hierarchical Inheritance
 Hybrid Inheritance
12 CS PROJECT

Single Inheritance :A derived class with only one class is


called single inheritance.

B
12 CS PROJECT

Multilevel Inheritance : A derived class with one base


class and that base class is a derived class of another is called
multilevel Inheritance.

C
12 CS PROJECT

Multiple Inheritance:A derived class with multiple base is


called multiple base is called multiple inheritance.

A B C

D
12 CS PROJECT

Hybrid Inheritance:Combination of multiple and


hierarchical inheritance is called hybrid inheritance.

A B C

E F G
12 CS PROJECT

Heirarchical inheritance:Multiple derived classes with


same base class is called hierarchical inheritance.

B C D
12 CS PROJECT

“RAILWAY RESERVATION SYSTEM”

INTRODUCTION TO PROJECT

Our project has various kinds of information that helps


regarding booking of tickets via railways .
Users will be able to search the train availability ,the exact fare
,the arrival and departure time of the train and they can also
book the ticket by using the debit ,credit or master card and after
booking the ticket if the user want to cancel it then they can
easily do it also.
12 CS PROJECT

Railway passengers frequently need to know about their ticket


reservation status, ticket availability on a particular train or for a
place, train arrival or departure details, specias of the
passengers.

OBJECTIVE OF THE PROJECT

The objective of the railway reservation system project is to


design software to fully automate the process of issuing a
railway ticket. That is:-
[Link] create a database of the trains.
[Link] search the trains it’s arrival and departure time,distance
between source and destination.
[Link] check the availability of the ticket.
12 CS PROJECT

[Link] calculate fare.


[Link] book the ticket.
[Link] cancel the ticket if necessary.

DESCRIPTION OF THE PROJECT

1. HEADER FILES USED AND THEIR


PURPOSE:-

 iostream.h-for cin and cout.



12 CS PROJECT

 conio.h-for clrscr(), getch(), getche() and gotoxy()


functions.
 process.h-for exit() function.
 string.h-for string handling.
 fstream.h-for file handling and for read(), write(), seekg(),
seekp(), tellg() and tellp() functions.
 stdio.h-for standard I/O operations.
 dos.h-for structure “date” and getdate() function.

2. DATA FILES USED AND THEIR PURPOSE:-

3. GLOBAL AND LOCAL FUNCTIONS


Functions are -
getting()
displayid()
getdetail()
displaydetail()
getresdet()
displayresdet()
void manage();
void can();
12 CS PROJECT

void user();
void database();
void res();
void reserve();
void displaypassdetail();
void cancell();
void enquiry();
CLASSES AND THEIR OBJECTS :-

Classes are :-

login
reser
canc

4. INBUILT FUNCTIONS AND THEIR


PURPOSE:-
1) clrscr()-to clear the screen after every run.
2) getch()-to hold the output screen.
3) gotoxy()-to move the cursor at desired position.

GLOBAL FUNCTION PROTOTYPE:-


 void welcome(); //to show welcome screen
 void interface(); //to show main menu
12 CS PROJECT

 void password(); //to take password and checking


 void library(); //to call library menu

CODINGS/SOURCE CODE

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<time.h>
#include<iomanip.h>
#include<fstream.h>
char f[10]="f";
char s[10]="s";
int addr,ad,flag,f1,d,m,i,amt;
char h;
float tamt;
class login
{
public:
char id[100];
char pass[100];
char *password;
void getid()
{
cout<<"Enter your id: ";
gets(id);
password=getpass("Enter the password: ");
strcpy(pass,password);
}
void displayid()
{
cout<<"Id:";puts(id);
cout<<"Password:";
puts(pass);
}
12 CS PROJECT

};
class detail
{
public:
int tno;
char tname[100];

char bp[100];
char dest[100];
int c1,c1fare;
int c2,c2fare;
int d,m,y;
void getdetail()
{
clrscr();
cout<<"Enter the details as follows :-\n";
cout<<"Train no : ";cin>>tno;
cout<<"Train name : ";
gets(tname);
cout<<"Boarding point : ";
gets(bp);
cout<<"Destination pt :";gets(dest);
cout<<"No of seats in first class & fare per ticket : ";
cin>>c1>>c1fare;
cout<<"No of seats in second class & fare per ticket : ";
cin>>c2>>c2fare;
cout<<"Date of travel : ";
cin>>d>>m>>y;
}
void displaydetail()
{
clrscr();
cout<<tno<<"\t"<<tname<<"\t"<<bp<<"\t"<<dest<<"\t";
cout<<c1<<"\t"<<c1fare<<"\t"<<c2<<"\t"<<c2fare<<"\t";
cout<<d<<"-"<<m<<"-"<<y<<"\t"<<endl;
}
};
class reser
{
public:
int pnr;
int tno;
char tname[100];
char bp[10];
char dest[100];
char pname[10][100];
12 CS PROJECT

int age[20];
char clas[10];
int nosr;
int i;
int d,m,y;
int con;

float amc;
void getresdet();
void displayresdet();
};
void reser :: getresdet()
{
clrscr();
cout<<"Enter the details as follows :- \n";
cout<<"Train no : ";
cin>>tno;
cout<<"Train name : ";
gets(tname);
cout<<"Boarding point : ";
gets(bp);
cout<<"Destination pt : ";
gets(dest);
cout<<"No of seats required : ";
cin>>nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name:";
gets(pname[i]);
cout<<"Passenger age : ";
cin>>age[i];
}
cout<<"Enter the class f-first class s-second class : ";
gets(clas);
cout<<"Date of travel : ";
cin>>d>>m>>y;
cout<<"Enter the concession category\n";
cout<<"[Link]\[Link] citizen\n";
cout<<"[Link] below 5 yrs\[Link]\n";
cin>>con;
cout<<"........END OF GETTING DETAILS.......\n";
}
void reser :: displayresdet()
{
clrscr();
cout<<"...........\n";
12 CS PROJECT

cout<<"...........\n";
cout<<"Pnr no : "<<pnr;
cout<<"\nTrain no : "<<tno;
cout<<"\nTrain name : ";
puts(tname);
cout<<"Boarding point : ";
puts(bp);
cout<<"Destination pt : ";puts(dest);
cout<<"No of seats reserved : "<<nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name : ";
puts(pname[i]);
cout<<"Passenger age : "<<age[i];
}

cout<<"\nYour class : ";


puts(clas);
cout<<"\nDate of reservation:"<<d<<"-"<<m<<"-"<<y;
cout<<"\nYour concession category:"<<con;
cout<<"\nYou must pay:"<<amc<<endl;
cout<<"***********************************************\n";
cout<<".......END OF RESERVATION......\n";
cout<<"***********************************************\n";
}
class canc
{
public:
int pnr;
int tno;
char tname[100];
char bp[10];
char dest[100];
char pname[10][100];
int age[20];
int i;
char clas[10];
int nosc;
int d,m,y;
float amr;
void getcancdet()
{
clrscr();
cout<<"Enter the details as follows\n";
cout<<"Pnr no : ";
cin>>pnr;
12 CS PROJECT

cout<<"Date of cancellation : ";


cin>>d>>m>>y;
cout<<".....END OF GETTING DETAILS......\n";
}
void displaycancdet();
};
void canc :: displaycancdet()
{
clrscr();
cout<<"...............\n";
cout<<"...............\n";
cout<<"Pnr no:"<<pnr;
cout<<"\nTrain no:"<<tno;
cout<<"\nTrain name:";
puts(tname);
cout<<"Boarding point:";
puts(bp);

cout<<"Destination pt:";
puts(dest);
cout<<"\nYour class:";puts(clas);
cout<<"No of seats to be cancelled:"<<nosc;
for(i=0;i<nosc;i++)
{
cout<<"Passenger name:";puts(pname[i]);
cout<<"passenger age:"<<age[i];
}
cout<<"\nDate of cancellation:"<<d<<"-"<<m<<"-"<<y;
cout<<"\nYou can collect:"<<amr<<"rs"<<endl;
cout<<"*****************************************\n";
cout<<".....END OF CANCELLATION.....\n";
cout<<"*****************************************\n";
}
void manage();
void can();
void user();
void database();
void res();
void reserve();
void displaypassdetail();
void cancell();
void enquiry();
void main()
{
clrscr();
int ch;
12 CS PROJECT

cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n";


cout<<" WELCOME TO RAILWAY RESERVATION SYSTEM \n";
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n";
do
{
cout<<" \n\n MAIN MENU\n";
cout<<"[Link] mode\[Link] mode\[Link]\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
if(ch==1)
database();
else if(ch==2)
user();
else if(ch==3)
exit(0);
else
cout<<"You had selected invalid option.";
}
while(ch<=3);
getch();
}
void database()
{
char *password;
char *pass="abc";
password=getpass("Enter the admininistrator password:");
detail a;
fstream f;
int ch;
char c;
if(strcmp(pass,password)!=0)
{
cout<<"You enterd the incorrect password. \n";
cout<<"Please try again later.\n";
goto h;
}
if(strcmp(pass,password)==0)
{
char c;
do
{
clrscr();
cout<<".....ADMINISTRATOR MENU.....\n";
cout<<"[Link] detail data base\[Link] details\n";
cout<<"[Link] details\[Link] management\n";
12 CS PROJECT

cout<<"[Link] passenger details\[Link] to main menu\n";


cout<<"Enter your choice:";
cin>>ch;

cout<<endl;
switch(ch)
{
case 1:
[Link]("[Link]",ios::out|ios::binary);
do
{
[Link]();
[Link]((char *) & a,sizeof(a));
cout<<"Do you want to add one more record?\n";
cout<<"y-for Yes\nn-for No\n";
cin>>c;
}while(c=='y');
[Link]();
break;
case 2:
[Link]("[Link]",ios::in|ios::out|ios::binary|ios::app);
[Link]();
[Link]((char *) & a,sizeof(a));
[Link]();
break;
case 3:
[Link]("[Link]",ios::in|ios::out|ios::binary|ios::app);
[Link](0);
while([Link]((char *) & a,sizeof(a)))
{
[Link]();
}
[Link]();
break;
case 4:
manage();
break;
case 5:
displaypassdetail();
break;
}
}while(ch<=5);

[Link]();
}
h:
12 CS PROJECT

}
void reserve()
{
int ch;
do
{
cout<<"[Link]\[Link] to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
res();
break;
}
}while(ch==1);
getch();
}
void res()
{
detail a;
reser b;
fstream f1,f2;
time_t t;
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link]("[Link]",ios::in|ios::out|ios::binary|ios::app);
int ch;
[Link]();
while([Link]((char *) &a,sizeof(a)))
{
if([Link]==[Link])
{
if(strcmp([Link],f)==0)
{
if(a.c1>=[Link])
{
amt=a.c1fare;
addr=[Link]();
ad=sizeof(a.c1);
[Link](addr-(7*ad));
a.c1=[Link];
[Link]((char *) & a.c1,sizeof(a.c1));
if([Link]==1)
{
cout<<"Concession category:MILITARY PERSONNEL\n";
12 CS PROJECT

[Link]=[Link]*((amt*50)/100);
}
else if([Link]==2)
{
cout<<"Concession category:SENIOR CITIZEN\n";
[Link]=[Link]*((amt*60)/100);
}
else if([Link]==3)
{
cout<<"Concession category:CHILDERN BELOW FIVE\n";
[Link]=0.0;
}
else if([Link]==4)
{
cout<<"You cannot get any concession\n";
[Link]=[Link]*amt;
}
srand((unsigned) time(&t));
[Link]=rand();
[Link]((char *) & b,sizeof(b));
[Link]();
cout<<"...........\n";
cout<<".......Your ticket is reserved......\n";
cout<<"......End of reservation menu-......\n";
}
else
{
cout<<"**********Sorry req seats not available********\n";
}
}
else if(strcmp([Link],s)==0)
{
if(a.c2>=[Link])
{
amt=a.c2fare;
addr=[Link]();
ad=sizeof(a.c2);
[Link](addr-(5*ad));
a.c2=[Link];
[Link]((char *) & a.c2,sizeof(a.c2));
if([Link]==1)
{
cout<<"Concession category:MILITARY PRESONNEL\n";
[Link]=[Link]*((amt*50)/100);
}
12 CS PROJECT

else if([Link]==2)
{
cout<<"Concession category:SENIOR CITIZEN\n";
[Link]=[Link]*((amt*60)/100);
}
else if([Link]==3)
{
cout<<"Concession category:CHILDERN BELOW FIVE\n";
[Link]=0.0;
}
else if([Link]==4)
{
cout<<"You cannot get any concession\n";
[Link]=[Link]*amt;
}
[Link]((char *) & b,sizeof(b));
[Link]();
cout<<".......\n";
cout<<"......Your ticket is reserved.....\n";
cout<<"......End of reservation.....\n";
}
else

{
cout<<"********Sorry req no of seats not available*******\n";
}
}
getch();

goto h;
}
else
{
flag=0;
}
}
if(flag==0)
{
cout<<"......Wrong train no.......\n";
cout<<"....Enter the train no from the data base..\n";
}
[Link]();
[Link]();
getch();
12 CS PROJECT

h:
}
void displaypassdetail()
{
clrscr();
fstream f;
reser b;
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link](0);
while([Link]((char *) & b,sizeof(b)))
{
[Link]();
}
[Link]();
getch();
}
void enquiry()
{
clrscr();
fstream f;
[Link]("[Link]",ios::in|ios::out|ios::binary);
detail a;
while([Link]((char *) & a,sizeof(a)))
{
[Link]();
}
getch();
}
void cancell()
{
clrscr();
detail a;
reser b;
canc c;
fstream f1,f2,f3;
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link]("[Link]",ios::in|ios::out|ios::binary);
cout<<"**********CANCELLATION MENU*********\n";
[Link]();
while([Link]((char *) & b,sizeof(b)))
{
if([Link]==[Link])
{
[Link]=[Link];
strcpy([Link],[Link]);
12 CS PROJECT

strcpy([Link],[Link]);
strcpy([Link],[Link]);
[Link]=[Link];
for(int j=0;j<[Link];j++)
{
strcpy([Link][j],[Link][j]);
[Link][j]=[Link][j];
}
strcpy([Link],[Link]);
if(strcmp([Link],f)==0)
{
while([Link]((char *) & a,sizeof(a)))
{
if([Link]==[Link])
{
a.c1=a.c1+[Link];
d=a.d;
m=a.m;
addr=[Link]();
ad=sizeof(a.c1);
[Link](addr-(7*ad));
[Link]((char *) & a.c1,sizeof(a.c1));
tamt=[Link];
if((c.d==d)&&(c.m==m))
{
cout<<"You are cancelling at the date of departure\n";
[Link]=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are cancelling at the month of departure\n";
[Link]=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are cancelling one month before the date of departure\n";
[Link]=tamt-((tamt*20)/100);
}
else
{
cout<<"Cancelling after the departure\n";
cout<<"Your request cannot be completed\n";
}
goto h;
[Link]();
}
12 CS PROJECT

}
}
else if(strcmp([Link],s)==0)
{
while([Link]((char *) & a,sizeof(a)))
{
if([Link]==[Link])
{
a.c2=a.c2+[Link];
d=a.d;
m=a.m;
addr=[Link]();
ad=sizeof(a.c2);
[Link](addr-(5*ad));
[Link]((char *) & a.c2,sizeof(a.c2));
tamt=[Link];
if((c.d==d)&&(c.m==m))
{
cout<<"You are cancelling at the date of departure\n";
[Link]=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are cancelling at the month of departure\n";
[Link]=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are cancelling one month before the date of departure\n";
[Link]=tamt-((tamt*20)/100);
}
else
{
cout<<"Cancelling after the departure\n";
cout<<"Your request cannot be completed\n";
}
goto h;
[Link]();
}
}
}
}
else
{
flag=0;
}
12 CS PROJECT

}
h:
if(flag==0)
{
cout<<"Enter the correct pnr no\n";
}
[Link]();
[Link]();
[Link]();
getch();
}
void can()
{
int ch;
do
{
cout<<".......CANCELLATION MENU.....\n";
cout<<"[Link]\[Link] to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
cancell();
break;
}
}while(ch==1);
getch();
}
void user()
{
clrscr();
login a;
int ch;
cout<<endl;
cout<<"**************************\n";
cout<<" WELCOME TO THE USER MENU\n";
cout<<"**************************\n";
char *password;
fstream f;
[Link]("[Link]",ios::in|ios::out|ios::binary);
char id[100];
int pass;
puts("\nEnter your id:");
gets(id);
12 CS PROJECT

cout<<"Enter password : ";


cin>>pass;
while([Link]((char*)& a,sizeof(a)))
{
if((strcmp([Link],id)==0)&&(strcmp([Link],password)==0))
{
do
{
clrscr();
cout<<"[Link]\[Link]\[Link]\[Link] to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
reserve();
break;
case 2:
cancell();
break;
case 3:
enquiry();
break;
}
}
while(ch<=3);
goto j;
}
else
{
d=1;
}
}
if(d==1)
{
cout<<"Enter your user id and password correctly\n";
}
getch();
j:
}
void manage()
{
int ch;
fstream f;
char c;
12 CS PROJECT

login a;
cout<<"....WELCOME TO THE USER MANAGEMENT MENU.....\n";
do
{
clrscr();
cout<<"[Link] id data base\[Link] details\n";
cout<<"[Link] details\[Link] to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
[Link]("[Link]",ios::out|ios::binary);
do
{
[Link]();
[Link]((char *) & a,sizeof(a));
cout<<"Do you want to add one more record\n";
cout<<"y-Yes\nn-No\n";
cin>>c;
}while(c=='y');
[Link]();
break;
case 2:
[Link]("[Link]",ios::in|ios::out|ios::binary|ios::app);
[Link]();
[Link]((char *) & a,sizeof(a));
[Link]();
break;
case 3:
[Link]("[Link]",ios::in|ios::out|ios::binary);

[Link](0);
while([Link]((char *) & a,sizeof(a)))
{
[Link]();
}
[Link]();
break;
}
}while(ch<=3);
getch();
}
12 CS PROJECT
12 CS PROJECT

OUTPUTS :-
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT
12 CS PROJECT

BIBLIOGRAPHY
1. Computer Science with C++ by Preeti Arora and Pinky
Gupta.
2. [Link]
3. [Link]
4. [Link]
5. Computer Science with C++ by Sumita Arora.

Common questions

Powered by AI

As a compiled language, C++ translates directly into machine code, which results in faster execution speeds compared to interpreted languages . This advantage is crucial for high-performance applications like the 'Railway Reservation System', which require efficient processing of data and quick response times to handle large volumes of transactions and user queries.

While static typing ensures type safety and reduces runtime errors, it may lead to less flexibility during development, requiring more detailed coding to address different data types explicitly . This can increase development complexity and time for systems like the 'Railway Reservation System', where varying user inputs and dynamic features are frequently encountered.

Reusability in object-oriented programming involves using existing, debugged classes across different projects, which saves time and effort . It allows developers to extend and build upon pre-existing modules, thus optimizing code development and maintenance, as seen in the 'Railway Reservation System', enhancing performance and reducing errors.

Polymorphism allows a single function or operator to behave differently based on the context, such as handling different data types or classes . This feature enhances both flexibility and reusability in the 'Railway Reservation System' by allowing more generalized coding of functions that can handle various inputs, reducing the need for duplicate code, and supporting future extensions with minimal modifications.

Data encapsulation in C++ combines data and functions into a single unit called a class, which restricts direct access to data and allows it to be accessed only through class functions . This promotes data hiding, enhancing the security of sensitive information within applications like the 'Railway Reservation System' and enables modular code architecture, simplifying maintenance and updates.

Hybrid inheritance involves combining multiple inheritance forms (multiple and hierarchical inheritance). While it enables comprehensive class hierarchies, it can introduce complexity, such as the diamond problem, where a derived class inherits from two classes that share a common base class, potentially causing conflicts in method and property access during the development of projects like the 'Railway Reservation System'.

C++ is portable due to its wide range of compilers that allow code using the standard library to run on most platforms with little to no modification . For projects like the 'Railway Reservation System', this portability enables the application to serve users across different operating systems seamlessly, enhancing usability and accessibility.

C++ is an open-source ISO-standardized language known for its speed and efficiency because it compiles directly to a machine's native code . It supports both static and dynamic type checking and is highly portable, allowing code to run on multiple platforms with minimal changes if it relies on the standard library . These features make C++ suitable for complex system software, such as a railway reservation system, where performance and cross-platform compatibility are crucial.

C++ supports both static (compile-time) and dynamic (run-time) type checking, which ensures that data types are verified either during compilation or execution, contributing to the reliability of the 'Railway Reservation System' . Static checking prevents type errors in earlier stages, while dynamic checking adds flexibility, ensuring robust handling of data during runtime operations.

Inheritance in C++ allows the creation of new classes based on existing ones, known as base classes . This reduces redundancy and promotes code reuse because derived classes inherit properties and behaviors from base classes, allowing developers to build complex systems like the 'Railway Reservation System' without having to rewrite shared logic.

You might also like