SlideShare a Scribd company logo
1 of 75
Railway Reservation System
Project Prepared By-
Nafiz Md Imtiaz Uddin
Id: 2520190011
Session: 2019-2023
Major: CST, JXUST
Supervised By-
Muhammad Asim Khan
Course Project of Algorithm,
Computer Science and Technology
Date of submission: 2020-12-29
A PROJECT ON
JIANGXI UNIVERSITY OF SCIENCE AND TECHNOLOGY
First we have to buy a ticket
Picture from www.financialexpress.com
Then, we can travel
CONTENTS
1. ACKNOWLEDGMENT
2. INTRODUCTION
(i) WHAT IS RESERVATION SYSTEM?
(ii) RAILWAY RESERVATION SYSTEM
3. HARDWARE REQUIRMENTS
4. SOFTWARE REQUIREMENTS
5. WHY CHOOSES C++
6. OBJECT ORIENTED PROGRAMS
7. Features of object-oriented programming
8. Feasibility of the proposed system
9. FEATURES OF PROJECT
10. STRUCTURE OF APPLICATION
11. USES OF HEADER FILES
12. CLASSES
13. MAIN MENU MAP
14. WHAT IS A FLOWCHART?
15. FLOW CHART FOR PROJECT
16. SOURCE CODE
17. SOME SCREENSHOT of IDE
18. OUTPUT
19. ADVANTAGE AND DISADVANTAGE
20. BIBLIOGRAPHY
ACKNOWLEDGMENT
I am extremely grateful to Mr. Muhammad Asim Khan, Teacher of Department of
Computer Science and Technology for his able guidance and useful suggestions, which
helped me in completing the project work, in time.
Finally, yet importantly, I would like to express my heartfelt thanks to my beloved
parents for their blessings and wishes for the successful completion of this project.
NAFIZ MD IMTIAZ UDDIN
INTRODUCTION
WHAT IS RESERVATION SYSTEM?
A project for automation of a railway reservation system. It facilitates the users
with a graphical interface for enquiring and reservation. The system has been to
be flexible to edit the database of train. The reservation can be done for the
journey from any place regardless to the place of reservation. It generates a
ticket or corresponding status message accordingly. Providing support for
reservation will also require that the system records information of the various
trains running on various routes as well as information about the routes
themselves (including the stations and the timings of arrival and departure
at/from each station).
Railway ticketing is used the conventional model of preparing standing ticket
and selling ticket manually, which resulted in a large labor intensity, low work
efficiency, disordered seat management and limited ticketing range.
RAILWAY RESERVATION SYSTEM
In this railway reservation system project in C++, users can get both the train
details and the train reservation details. The details to be provided for train are
train no., train name, boarding point, destination point, no. of seats in first class
and fare per ticket, no. of seats in second class and fare per ticket and date of
travel.
And, in case of reservation details, the information to be provided are train no.,
train name, boarding point, destination point, no. of seats required, seat class
specification, date of reservation, passenger category and amount to be paid.
According to the no. of seats, additional information – passenger name and
passenger age are to be provided. The passenger category is divided as:
military, senior citizen, children and none.
HARDWARE REQUIREMENTS
Hardware Description
Processor Pentium III (or others)
RAM 64 MB (or above)
Hard disk 20 GB (or others)
SOFTWARE REQUIREMENTS
Software Description
Windows 10 Operating System (or any OS)
Turbo C++ For execution of the program
PowerPoint For presentation of the output
WHY CHOOSES C++
I opted C++ as the development language for my project because C++ is a
versatile language for handling very large programs. C++ follows all the
standards given by OOPs.
Advantages of using C++ in the project:-
Using C++ (an Object Oriented Programming language) allowed breaking
complex large software programs to simpler, smaller and manageable
components.
OBJECT ORIENTED PROGRAMS
DATA
FUNCTION
DATA
FUNCTION
DATA
FUNCTION
Communication
Object A
Object B
Object C
Features of object-oriented programming
• Data structures are designed such that they characterized the object.
• Functions that operate on the data of an object are tied together in the
data structure.
• Data is hidden and cannot be accessed by external functions.
• Object may communicate with each other through function.
• New data and functions can be easily added where ever necessary.
• Programs are divided into what are known as object.
Feasibility of the proposed system
As the computerized is already in operation there is no likelihood of any direct
or indirect resistance to implementation of the proposed system. As the
technology (Hardware, Software and the Networking) has become cost
effective, economic feasibility of the project can be incurred upon.
Feasibility is the determination of whether or not a project is worth doing. The
process followed in making this determination is called a feasibility study. In
this topic we study our project and check it under consideration of different
feasible condition and measure its feasibility potentials.
Feasibility of the proposed system
Technical Feasibility
• This Hardware requirement is moderate (Min Hard Drive 25 MB with 4 MB RAM Minimum
is needed) and software requirement wants C++.
• Produce output very quickly with quit good response time depending on PC’s speed.
• Can process a fair amount of data instantly depending on PC’s speed.
Operational Feasibility
• New PC’s and other electronic equipment like printers are to be purchased to implement the
software application on.
Also computer stationary like floppies, printing paper, ink cartridges for printer are required.
New system requires some computer literate trained staff to operate on computerized system.
Economic Feasibility
• There will be a certain decrease in expenditure on employed manpower to do the work
earlier.
Although initial cost to implement the system is high (include purchase of new PC, printer etc.)
but in long term it will save the extra cost in regular purchase of office stationary. Also keeping
in mind the efficient increase in performance it is worthy.
FEATURES OF PROJECT
Administrator mode:
There are two modes in this project – the administrator mode and the user
mode. For the first time a person has to create Users from the Admin section.
Once users are created, the person can use the same user again and again, and
they will be stored in separate files.
The operations related to both these modes are quite similar in this railway
reservation system project in C++. In Admin part, the person can create detail
database, add details, display details, perform user management functions and
display passenger details.
FEATURES OF PROJECT
User mode:
As aforementioned, at first need to go to the administrator mode and create
users. After that, a user can use these system, and the information related to
them will be recorded in separate files.
STRUCTURE OF APPLICATION
Administration
mode
User mode Exit the Application
USES OF HEADER FILES
• #include<iostream.h>-For standard input-output stream.
• #include<stdio.h>- For basic input, output and file handling functions
• #include<conio.h>- For getch() and clrscr() functions
• #include<stdlib.h>- For involving memory allocation, process control, etc
• #include<string.h>- For string functions such as strcmpi()
• #include<time.h>- For time and date functions
• #include<iomanip.h>- For manipulate the output C++ program
• #include<fstream.h>- For using to create files, write information
to files and read information from files
CLASSES
• login: This class is mainly made for user site. First of all, from Admin site will create
id and password for user. Then user can easily access User mode.
• detail: This class is about the details of the train. When we add new files we need to
specify the train number boarding point, Destination point, number of seats and fare
per ticket and also mention Date of travel.
• reser: When again we need to fill in another details. We have go to Add new file in
this option. If we mention Train no, Train name, Boarding point, Destination point
and number of seats add. This means that another new detail has been added to our
application.
• canc: This class is used for cancellation system. So, the passenger mentioned Pnr no,
Date of cancellation etc. This passenger details will be remove from database.
MAIN MENU MAP
MAIN MENU
1. Administration mode
2. User mode
3. Exit the Application
ADMINISTRATOR MENU
1. To create new file
2. Add new details
3. Show details
4. User id & password mode
5. Show passenger details
6. Return to previous mode
WHAT IS A FLOWCHART?
A flowchart is a picture of the separate steps of a process in sequential order. It is a
generic tool that can be adapted for a wide variety of purposes, and can be used to
describe various processes, such as a manufacturing process, an administrative or
service process, or a project plan. It's a common process analysis tool and one of the
seven basic quality tools.
WHEN TO USE A FLOWCHART:
a. To develop understanding of how a process is done
b. To study a process for improvement
c. To communicate to others how a process is done
d. When better communication is needed between people involved with the same
process
e. To document a process
f. When planning a project
FLOW CHARTS FOR PROJECT
START
1. Administration mode
Need
password STOP
1. Create detail data base
2. Add details
3. Display details
4. User management
5. Display passenger details
6. Return to main menu
If password doesn’t match
X
B
C
D
E
F
B
HERE BEGIN LOOP
FOR ACCEPTING
TRAIN DETAILS
ADD TRAIN
DETAILS
SAVE DETAILS TO FILE
(t.txt)
HERE LOOP WILL
BE STOP FOR
ACCEPTING
RECORD
X
C
HERE BEGIN LOOP
FOR ACCEPTING
NEW TRAIN DETAILS
ACCEPT TRAIN
DETAILS
SAVE DETAILS PREVIOUS
FILE
HERE LOOP WILL
BE STOP FOR
ACCEPTING
RECORD
X
D
HERE BEGIN LOOP
FOR SHOWING
TRAIN DETAILS
START LOOP.
AFTER SHOWING
DETAILS. IT WILL
BE STOP
X
DISPLAY
RECORDS ONE
BY ONE
E
1. Create id
2. Add new details
3. Show details
4. Return to previous mode
P
X
R
Q
P
THEN AGAIN
START LOOP FOR
ANOTHER ID &
PASSWORD
CREATE
USER ID
SAVE FOR USER
MANAGEMENT SYSTEM
S
CREATE
USER
PASSWORD
CONFIRMATION
SAVE DETAILS
CONFIRMATION
START LOOP
X
Q START LOOP
CREATE
USER ID
SAVE TO USER FILE
CREATE
USER
PASSWORD
LOOP WILL BE
STOP
X
R
HERE BEGIN LOOP
FOR SHOWING
TRAIN DETAILS
START LOOP.
AFTER SHOWING
DETAILS. IT WILL
BE STOP
X
DISPLAY USER ID
AND PASSWORD
ONE BY ONE
START
2. USER MODE
NEED USER
PASSWORD
STOP
1. Reserve
2. Cancel
3. Enquiry
4. Return to previous mode
Y
M
N
O
S
NEED
USER ID
M
Y
1. Reserve seat
2. Return to previous mode
1. Train no
2. Train name
3. Boarding point
4. Destination point
5. No of seats required
START LOOP FOR
ACCEPTING DETAILS
K
W
SEARCH FOR AVAILABLE
TRAINS
W
SHOW ALL THE
AVAILABLE TRAINS
NOT AVAILABLE
TRAIN
If train record found If train record not found
V
V
ACCEPT TRAIN
NUMBER
SEARCH FOR AVAILABLE
TRAINS
ACCEPT NUMBER
OF PASSENGER
CANNOT
REQUIRED
Y
R
R ACCEPT CLASS INCORRECT
CLASS
CANNOT BOOK
REQUIRED
TICKETS
Y
READ FILE
SAVE BOOKING
DETAILS INFO FILE
START LOOP TO
ACCEPT PASSENGER
LOOP
ACCEP PASSENGER
DETAILS
V
V
SAVE DETAILS TO
FILE
STOP LOOP TO ACCEPT
PASSENGER LOOP
SHOW
BOOKING
DETAILS
Y
1. Military
2. Senior citizen
3. Children age below 5
4. None
User have to select any
category
START
N
ACCEPT PNR
NUMBER
READ FROM FILE
SHOW BOOKING
DETAILS T
INVALID PNR
IF PNR doesn’t match
STOP
Y
T
CONFIRMATION
FOR
DELETATION
BOOKING HAS
BEEN
CANCELLED
DELETE DETAILS
FROM FILE
Y
NO
YES
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;
float tamt;
class login {
public:
char id[100];
char pass[100];
char *password;
void getid(){
cout<<"Please enter your id:";
01
gets(id);
password=getpass("Please enter the password:");
strcpy(pass,password);
}
void displayid(){
cout<<"Id:";
puts(id);
cout<<"Password:";
puts(pass);} };
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(){
cout<<"Enter the details as followsn";
cout<<"Train no:";
cin>>tno;
02
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(){
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];
03
char bp[10];
char dest[100];
char pname[10][100];
int age[20];
char clas[10];
int nosr;
int i;
int d,m,y;
int con;
float amc;
void getresdet() {
cout<<"Enter the details as followsn";
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;
04
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 categoryn";
cout<<"1.Militaryn2.Senior citizenn";
cout<<"3.Children below 5 yrsn4.Nonen";
cin>>con;
cout<<"............END OF GETTING DETAILS............n"; }
void displayresdet(){
cout<<"...............................................n";
cout<<"...............................................n";
cout<<"Pnr no:"<<pnr;
cout<<"nTrain no:"<<tno;
cout<<"nTrain name:";
puts(tname);
cout<<"Boarding point:";
05
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];
06
char pname[10][100];
int age[20];
int i;
char clas[10];
int nosc;
int d,m,y;
float amr;
void getcancdet(){
cout<<"Enter the details as followsn";
cout<<"Pnr no:";
cin>>pnr;
cout<<"Date of cancellation:";
cin>>d>>m>>y;
cout<<"...........END OF GETTING DETAILS...........n"; }
void displaycancdet(){
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);
07
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;
cout<<"-------------------------------------------------n";
cout<<".........WELCOME TO RAILWAY RESERVATION SYSTEM..........n";
cout<<"--------------------------------------------------n";
08
do{
cout<<"~~~~~~~~~~~~~~~~~~~~~~MAIN MENU~~~~~~~~~~~~~~~~n";
cout<<"Press 1. Administration modenPress 2.User modenPress 3.Exit the Applicationn";
cout<<"Please enter your option:";
cin>>ch;
cout<<endl;
switch(ch) {
case 1:
database();
break;
case 2:
user();
break;
case 3:
exit(0);}}
while(ch<=3);
getch();}
void database(){
char *password;
char *pass="nafiz#";
password=getpass("Enter the admininistrator password:");
detail a;
fstream f;
09
int ch;
char c;
if(strcmp(pass,password)!=0){
cout<<"Please enter the correct admininistrator password: n";
cout<<"You cannot login here. Thank youn";
goto h;}
if(strcmp(pass,password)==0) {
char c;
do {
cout<<"...........ADMINISTRATOR MENU...........n";
cout<<"Press 1.To create new filenPress 2.Add new detailsn";
cout<<"Press 3.Show detailsnPress 4.User id & password moden";
cout<<"Press 5.Show passenger detailsnPress 6.Return to previous moden";
cout<<"Please enter your option: ";
cin>>ch;
cout<<endl;
switch(ch){
case 1:
f.open("t.txt",ios::out|ios::binary);
do{
a.getdetail();
f.write((char *) & a,sizeof(a));
cout<<"Do you want to add one more record?n";
cout<<"y-for Yes andnn-for Non";
cin>>c; }
10
while(c=='y');
f.close();
break;
case 2:
f.open("t.txt",ios::in|ios::out|ios::binary|ios::app);
a.getdetail();
f.write((char *) & a,sizeof(a));
f.close();
break;
case 3:
f.open("t.txt",ios::in|ios::out|ios::binary|ios::app);
f.seekg(0);
while(f.read((char *) & a,sizeof(a)))
{
a.displaydetail();
}
f.close();
break;
case 4:
manage();
break;
case 5:
displaypassdetail();
break; }}
while(ch<=5);
f.close();}
h:}
void reserve(){
int ch;
11
do{
cout<<"Press 1.Reserve seatnPress 2.Return to previous moden";
cout<<"Please enter your option: ";
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;
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary|ios::app);
int ch;
b.getresdet();
while(f1.read((char *) &a,sizeof(a))) {
if(a.tno==b.tno) {
if(strcmp(b.clas,f)==0) {
if(a.c1>=b.nosr) {
amt=a.c1fare;
addr=f1.tellg();
12
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
a.c1=a.c1-b.nosr;
f1.write((char *) & a.c1,sizeof(a.c1));
if(b.con==1) {
cout<<"Category:Government peoplen";
b.amc=b.nosr*((amt*50)/100); }
else if(b.con==2) {
cout<<"Category:Disabled peoplen";
b.amc=b.nosr*((amt*60)/100); }
else if(b.con==3) {
cout<<"Category:Children under age fiven";
b.amc=0.0; }
else if(b.con==4) {
cout<<"You cannot get any categoryn";
b.amc=b.nosr*amt; }
srand((unsigned) time(&t));
b.pnr=rand();
f2.write((char *) & b,sizeof(b));
b.displayresdet();
cout<<"------------------------------------------------------n";
cout<<"--------------Your ticket is reserved-----------n";
cout<<"-----------------End of reservation menu-------n"; }
else {
cout<<"**********Oh! sorry request seats not available***************n";} }
else if(strcmp(b.clas,s)==0) {
if(a.c2>=b.nosr){
13
amt=a.c2fare;
addr=f1.tellg();
ad=sizeof(a.c2);
f1.seekp(addr-(5*ad));
a.c2=a.c2-b.nosr;
f1.write((char *) & a.c2,sizeof(a.c2));
if(b.con==1) {
cout<<"Category:Government peoplen";
b.amc=b.nosr*((amt*50)/100); }
else if(b.con==2) {
cout<<"Category:Disabled peoplen";
b.amc=b.nosr*((amt*60)/100); }
else if(b.con==3) {
cout<<"Category:Children under age fiven";
b.amc=0.0; }
else if(b.con==4) {
cout<<"You cannot get any categoryn";
b.amc=b.nosr*amt; }
f2.write((char *) & b,sizeof(b));
b.displayresdet();
cout<<"---------------------------------------n";
cout<<"--------Your ticket is reserved--------n";
cout<<"------------End of reservation---------n";}
else{
cout<<"**********Oh! sorry request seats not available***************n";} }
getch();
goto h;}
else{
flag=0;}}
14
if(flag==0) {
cout<<"...................You press wrong train no......................n";
cout<<"......Please enter the train no from the data base.....n"; }
f1.close();
f2.close();
getch();
h:}
void displaypassdetail(){
fstream f;
reser b;
f.open("p.txt",ios::in|ios::out|ios::binary);
f.seekg(0);
while(f.read((char *) & b,sizeof(b))) {
b.displayresdet(); }
f.close();
getch();}
void enquiry(){
fstream f;
f.open("t.txt",ios::in|ios::out|ios::binary);
detail a;
while(f.read((char *) & a,sizeof(a))) {
a.displaydetail(); }
getch();}
void cancell(){
detail a;
reser b;
canc c;
fstream f1,f2,f3;
15
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary);
f3.open("cn.txt",ios::in|ios::out|ios::binary);
cout<<"**********CANCELLATION MENU*********n";
c.getcancdet();
while(f2.read((char *) & b,sizeof(b))) {
if(b.pnr==c.pnr) {
c.tno=b.tno;
strcpy(c.tname,b.tname);
strcpy(c.bp,b.bp);
strcpy(c.dest,b.dest);
c.nosc=b.nosr;
for(int j=0; j<c.nosc; j++) {
strcpy(c.pname[j],b.pname[j]);
c.age[j]=b.age[j]; }
strcpy(c.clas,b.clas);
if(strcmp(c.clas,f)==0){
while(f1.read((char *) & a,sizeof(a))) {
if(a.tno==c.tno) {
a.c1=a.c1+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
f1.write((char *) & a.c1,sizeof(a.c1));
tamt=b.amc;
16
if((c.d==d)&&(c.m==m)) {
cout<<"You are cancelling at the date of departuren";
c.amr=tamt-((tamt*60)/100); }
else if(c.m==m) {
cout<<"You are cancelling at the month of departuren";
c.amr=tamt-((tamt*50)/100); }
else if(m>c.m) {
cout<<"You are cancelling one month before the date of departuren";
c.amr=tamt-((tamt*20)/100); }
else {
cout<<"Cancelling after the departuren";
cout<<"Your request cannot be completedn";}
goto h;
c.displaycancdet();}} }
else if(strcmp(c.clas,s)==0) {
while(f1.read((char *) & a,sizeof(a))) {
if(a.tno==c.tno) {
a.c2=a.c2+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c2);
f1.seekp(addr-(5*ad));
f1.write((char *) & a.c2,sizeof(a.c2));
tamt=b.amc;
if((c.d==d)&&(c.m==m)) {
cout<<"You are cancelling at the date of departuren";
c.amr=tamt-((tamt*60)/100); }
17
else if(c.m==m) {
cout<<"You are cancelling at the month of departuren";
c.amr=tamt-((tamt*50)/100); }
else if(m>c.m) {
cout<<"You are cancelling one month before the date of departuren";
c.amr=tamt-((tamt*20)/100); }
else {
cout<<"Cancelling after the departuren";
cout<<"Your request cannot be completedn"; }
goto h;
c.displaycancdet(); } } } }
else {
flag=0; } }
h:
if(flag==0) {
cout<<"Enter the correct pnr non"; }
f1.close();
f2.close();
f3.close();
getch();}
void can(){
int ch;
do {
cout<<".................CANCELLATION MENU.........n";
cout<<"Press 1.CancelnPress 2.Return to previous moden";
cout<<"Please enter your option: ";
cin>>ch;
cout<<endl;
switch(ch) {
case 1:
18
cancell();
break; } }
while(ch==1);
getch();}
void user(){
login a;
int ch;
cout<<"*****************************************************n";
cout<<"***********WELCOME TO THE USER MENU**************n";
cout<<"****************************************************n";
char *password;
fstream f;
f.open("id.txt",ios::in|ios::out|ios::binary);
char id[100];
puts("Please enter your id:");
gets(id);
password=getpass("Please enter your password:");
while(f.read((char *) & a,sizeof(a))){
if((strcmp(a.id,id)==0)&&(strcmp(a.pass,password)==0)) {
do {
cout<<"Press 1.ReservenPress 2.CancelnPress 3.EnquirynPress 4.Return to previous moden";
cout<<"Please enter your option: ";
cin>>ch;
cout<<endl;
switch(ch) {
case 1:
reserve();
break;
case 2:
cancell();
break;
case 3:
enquiry();
break; } }
while(ch<=3);
goto j; }
19
else {
d=1;} }
if(d==1) {
cout<<"Please enter your user id and password correctlyn"; }
getch();
j:}
void manage(){
int ch;
fstream f;
char c;
login a;
cout<<".........WELCOME TO THE USER MANAGEMENT MENU........n";
do {
cout<<"Press 1.Create idn2.Add new detailsn";
cout<<"Press 3.Show detailsnPress 4.Return to previous moden";
cout<<"Please enter your option:";
cin>>ch;
cout<<endl;
switch(ch){
case 1:
f.open("id.txt",ios::out|ios::binary);
do {
a.getid();
f.write((char *) & a,sizeof(a));
cout<<"Do you want to add one more record?n";
cout<<"y-Yes and nn-Non";
cin>>c;}
20
while(c=='y');
f.close();
break;
case 2:
f.open("id.txt",ios::in|ios::out|ios::binary|ios::app);
a.getid();
f.write((char *) & a,sizeof(a));
f.close();
break;
case 3:
f.open("id.txt",ios::in|ios::out|ios::binary);
f.seekg(0);
while(f.read((char *) & a,sizeof(a))) {
a.displayid(); }
f.close();
break; } }
while(ch<=3);
getch();}
21
SOME SCREENSHOT of IDE
OUTPUT
After complete this code.
Press→ CTRL + F9
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
ADVANTAGES AND DISADVANTAGES
Advantage
1. Railway Reservation System provide greater through-put for better management of stocks.
2. Through the system we can manage the tickets reservation in better way and more efficiently.
3. We can increase the sales by reducing processing of tickets reservation in less time.
4. We can avoid manual mistake and user-defined problems.
5. We can also decrease manpower and increase the revenue.
Disadvantage
1. It increases unemployment.
2. As it is not so big application but it needs a specific user to use it.
BIBLIOGRAPHY
HELP FROM THESE BOOKS:
1. A First Book of ANSI C – Gary J. Bronson
2. The C++ Programming Language- Bjarne Stroustrup
3. A Practical Introduction to Data Structures and Algorithm Analysis- Clifford A. Shaffer
HELP FROM INTERNET:
1. www.wikipedia.com
2. www.stackoverflow.com
3. www.webopedia.com
4. www.programiz.com
5. https://www.cppbuzz.com/programs/c++/c++-programs
Thank you so much

More Related Content

What's hot

Online Bus Ticket Reservation System
Online Bus Ticket Reservation SystemOnline Bus Ticket Reservation System
Online Bus Ticket Reservation System
Tuvshinbayar Davaa
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
Sandip Murari
 
Bus Ticket Management System Documentation
Bus Ticket Management System DocumentationBus Ticket Management System Documentation
Bus Ticket Management System Documentation
muzammil siddiq
 
Vehicle tracking system
Vehicle tracking systemVehicle tracking system
Vehicle tracking system
Sujit9561
 

What's hot (20)

SRS on airline reservation system
SRS on airline reservation system SRS on airline reservation system
SRS on airline reservation system
 
Report on online bus management
Report on online bus managementReport on online bus management
Report on online bus management
 
Online Bus Ticket Reservation System
Online Bus Ticket Reservation SystemOnline Bus Ticket Reservation System
Online Bus Ticket Reservation System
 
Tour and travel management system
Tour and travel management systemTour and travel management system
Tour and travel management system
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
 
tour management system
tour management systemtour management system
tour management system
 
Tour and Travel Management System ppt
Tour and Travel Management System pptTour and Travel Management System ppt
Tour and Travel Management System ppt
 
Airline Reservation System - Software Engineering
Airline Reservation System - Software EngineeringAirline Reservation System - Software Engineering
Airline Reservation System - Software Engineering
 
Online Bus ticket reservation
Online Bus ticket reservationOnline Bus ticket reservation
Online Bus ticket reservation
 
Smart Bus Ticket System using QR code
Smart Bus Ticket System using QR codeSmart Bus Ticket System using QR code
Smart Bus Ticket System using QR code
 
Online railway reservation system
Online railway reservation systemOnline railway reservation system
Online railway reservation system
 
Bus Ticket Management System Documentation
Bus Ticket Management System DocumentationBus Ticket Management System Documentation
Bus Ticket Management System Documentation
 
Online reservation system project report(web development)
Online reservation system project report(web development)Online reservation system project report(web development)
Online reservation system project report(web development)
 
Online Bus Ticketing System
Online Bus Ticketing SystemOnline Bus Ticketing System
Online Bus Ticketing System
 
An Online Car Parking System (Features & Diagrams Only)
An Online Car Parking System (Features & Diagrams Only)An Online Car Parking System (Features & Diagrams Only)
An Online Car Parking System (Features & Diagrams Only)
 
Presentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project PlanningPresentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project Planning
 
Vehicle tracking system
Vehicle tracking systemVehicle tracking system
Vehicle tracking system
 
Student management system
Student management systemStudent management system
Student management system
 
Student Management System
Student Management System Student Management System
Student Management System
 
ONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEMONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEM
 

Similar to Presentation of Turbo C++ || Railway Reservation System project || B.Sc. student

Etaxi Documentation
Etaxi DocumentationEtaxi Documentation
Etaxi Documentation
M.Saber
 
Software Engineering ppt
Software Engineering pptSoftware Engineering ppt
Software Engineering ppt
shruths2890
 

Similar to Presentation of Turbo C++ || Railway Reservation System project || B.Sc. student (20)

Rrs
RrsRrs
Rrs
 
Synopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation SystemSynopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation System
 
Car Rental in C++
Car Rental in C++Car Rental in C++
Car Rental in C++
 
Project synopsis.
Project synopsis.Project synopsis.
Project synopsis.
 
Etaxi Documentation
Etaxi DocumentationEtaxi Documentation
Etaxi Documentation
 
payroll management -1.
payroll management -1.payroll management -1.
payroll management -1.
 
Implementation of Public Transport Sytem with Journey Planner
Implementation of Public Transport Sytem with Journey PlannerImplementation of Public Transport Sytem with Journey Planner
Implementation of Public Transport Sytem with Journey Planner
 
PBL2.0.pptx
PBL2.0.pptxPBL2.0.pptx
PBL2.0.pptx
 
PBL2.0.pptx
PBL2.0.pptxPBL2.0.pptx
PBL2.0.pptx
 
School management System
School management SystemSchool management System
School management System
 
Report for-smart-trash-project
Report for-smart-trash-project Report for-smart-trash-project
Report for-smart-trash-project
 
Software Engineering ppt
Software Engineering pptSoftware Engineering ppt
Software Engineering ppt
 
NiranjanTMS.pptx
NiranjanTMS.pptxNiranjanTMS.pptx
NiranjanTMS.pptx
 
Online final report
Online final reportOnline final report
Online final report
 
Bus information live monitoring system
Bus information live monitoring systemBus information live monitoring system
Bus information live monitoring system
 
V5I1-IJERTV5IS010514
V5I1-IJERTV5IS010514V5I1-IJERTV5IS010514
V5I1-IJERTV5IS010514
 
Project report
Project report Project report
Project report
 
Project for Student Result System
Project for Student Result SystemProject for Student Result System
Project for Student Result System
 
bus reservation.pptx
bus reservation.pptxbus reservation.pptx
bus reservation.pptx
 
Blue book
Blue bookBlue book
Blue book
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 

Recently uploaded (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 

Presentation of Turbo C++ || Railway Reservation System project || B.Sc. student

  • 1. Railway Reservation System Project Prepared By- Nafiz Md Imtiaz Uddin Id: 2520190011 Session: 2019-2023 Major: CST, JXUST Supervised By- Muhammad Asim Khan Course Project of Algorithm, Computer Science and Technology Date of submission: 2020-12-29 A PROJECT ON JIANGXI UNIVERSITY OF SCIENCE AND TECHNOLOGY
  • 2. First we have to buy a ticket Picture from www.financialexpress.com Then, we can travel
  • 3. CONTENTS 1. ACKNOWLEDGMENT 2. INTRODUCTION (i) WHAT IS RESERVATION SYSTEM? (ii) RAILWAY RESERVATION SYSTEM 3. HARDWARE REQUIRMENTS 4. SOFTWARE REQUIREMENTS 5. WHY CHOOSES C++ 6. OBJECT ORIENTED PROGRAMS 7. Features of object-oriented programming 8. Feasibility of the proposed system 9. FEATURES OF PROJECT 10. STRUCTURE OF APPLICATION 11. USES OF HEADER FILES 12. CLASSES 13. MAIN MENU MAP 14. WHAT IS A FLOWCHART? 15. FLOW CHART FOR PROJECT 16. SOURCE CODE 17. SOME SCREENSHOT of IDE 18. OUTPUT 19. ADVANTAGE AND DISADVANTAGE 20. BIBLIOGRAPHY
  • 4. ACKNOWLEDGMENT I am extremely grateful to Mr. Muhammad Asim Khan, Teacher of Department of Computer Science and Technology for his able guidance and useful suggestions, which helped me in completing the project work, in time. Finally, yet importantly, I would like to express my heartfelt thanks to my beloved parents for their blessings and wishes for the successful completion of this project. NAFIZ MD IMTIAZ UDDIN
  • 5. INTRODUCTION WHAT IS RESERVATION SYSTEM? A project for automation of a railway reservation system. It facilitates the users with a graphical interface for enquiring and reservation. The system has been to be flexible to edit the database of train. The reservation can be done for the journey from any place regardless to the place of reservation. It generates a ticket or corresponding status message accordingly. Providing support for reservation will also require that the system records information of the various trains running on various routes as well as information about the routes themselves (including the stations and the timings of arrival and departure at/from each station). Railway ticketing is used the conventional model of preparing standing ticket and selling ticket manually, which resulted in a large labor intensity, low work efficiency, disordered seat management and limited ticketing range.
  • 6. RAILWAY RESERVATION SYSTEM In this railway reservation system project in C++, users can get both the train details and the train reservation details. The details to be provided for train are train no., train name, boarding point, destination point, no. of seats in first class and fare per ticket, no. of seats in second class and fare per ticket and date of travel. And, in case of reservation details, the information to be provided are train no., train name, boarding point, destination point, no. of seats required, seat class specification, date of reservation, passenger category and amount to be paid. According to the no. of seats, additional information – passenger name and passenger age are to be provided. The passenger category is divided as: military, senior citizen, children and none.
  • 7. HARDWARE REQUIREMENTS Hardware Description Processor Pentium III (or others) RAM 64 MB (or above) Hard disk 20 GB (or others)
  • 8. SOFTWARE REQUIREMENTS Software Description Windows 10 Operating System (or any OS) Turbo C++ For execution of the program PowerPoint For presentation of the output
  • 9. WHY CHOOSES C++ I opted C++ as the development language for my project because C++ is a versatile language for handling very large programs. C++ follows all the standards given by OOPs. Advantages of using C++ in the project:- Using C++ (an Object Oriented Programming language) allowed breaking complex large software programs to simpler, smaller and manageable components.
  • 11. Features of object-oriented programming • Data structures are designed such that they characterized the object. • Functions that operate on the data of an object are tied together in the data structure. • Data is hidden and cannot be accessed by external functions. • Object may communicate with each other through function. • New data and functions can be easily added where ever necessary. • Programs are divided into what are known as object.
  • 12. Feasibility of the proposed system As the computerized is already in operation there is no likelihood of any direct or indirect resistance to implementation of the proposed system. As the technology (Hardware, Software and the Networking) has become cost effective, economic feasibility of the project can be incurred upon. Feasibility is the determination of whether or not a project is worth doing. The process followed in making this determination is called a feasibility study. In this topic we study our project and check it under consideration of different feasible condition and measure its feasibility potentials.
  • 13. Feasibility of the proposed system Technical Feasibility • This Hardware requirement is moderate (Min Hard Drive 25 MB with 4 MB RAM Minimum is needed) and software requirement wants C++. • Produce output very quickly with quit good response time depending on PC’s speed. • Can process a fair amount of data instantly depending on PC’s speed. Operational Feasibility • New PC’s and other electronic equipment like printers are to be purchased to implement the software application on. Also computer stationary like floppies, printing paper, ink cartridges for printer are required. New system requires some computer literate trained staff to operate on computerized system. Economic Feasibility • There will be a certain decrease in expenditure on employed manpower to do the work earlier. Although initial cost to implement the system is high (include purchase of new PC, printer etc.) but in long term it will save the extra cost in regular purchase of office stationary. Also keeping in mind the efficient increase in performance it is worthy.
  • 14. FEATURES OF PROJECT Administrator mode: There are two modes in this project – the administrator mode and the user mode. For the first time a person has to create Users from the Admin section. Once users are created, the person can use the same user again and again, and they will be stored in separate files. The operations related to both these modes are quite similar in this railway reservation system project in C++. In Admin part, the person can create detail database, add details, display details, perform user management functions and display passenger details.
  • 15. FEATURES OF PROJECT User mode: As aforementioned, at first need to go to the administrator mode and create users. After that, a user can use these system, and the information related to them will be recorded in separate files.
  • 17. USES OF HEADER FILES • #include<iostream.h>-For standard input-output stream. • #include<stdio.h>- For basic input, output and file handling functions • #include<conio.h>- For getch() and clrscr() functions • #include<stdlib.h>- For involving memory allocation, process control, etc • #include<string.h>- For string functions such as strcmpi() • #include<time.h>- For time and date functions • #include<iomanip.h>- For manipulate the output C++ program • #include<fstream.h>- For using to create files, write information to files and read information from files
  • 18. CLASSES • login: This class is mainly made for user site. First of all, from Admin site will create id and password for user. Then user can easily access User mode. • detail: This class is about the details of the train. When we add new files we need to specify the train number boarding point, Destination point, number of seats and fare per ticket and also mention Date of travel. • reser: When again we need to fill in another details. We have go to Add new file in this option. If we mention Train no, Train name, Boarding point, Destination point and number of seats add. This means that another new detail has been added to our application. • canc: This class is used for cancellation system. So, the passenger mentioned Pnr no, Date of cancellation etc. This passenger details will be remove from database.
  • 19. MAIN MENU MAP MAIN MENU 1. Administration mode 2. User mode 3. Exit the Application ADMINISTRATOR MENU 1. To create new file 2. Add new details 3. Show details 4. User id & password mode 5. Show passenger details 6. Return to previous mode
  • 20. WHAT IS A FLOWCHART? A flowchart is a picture of the separate steps of a process in sequential order. It is a generic tool that can be adapted for a wide variety of purposes, and can be used to describe various processes, such as a manufacturing process, an administrative or service process, or a project plan. It's a common process analysis tool and one of the seven basic quality tools. WHEN TO USE A FLOWCHART: a. To develop understanding of how a process is done b. To study a process for improvement c. To communicate to others how a process is done d. When better communication is needed between people involved with the same process e. To document a process f. When planning a project
  • 21. FLOW CHARTS FOR PROJECT START 1. Administration mode Need password STOP 1. Create detail data base 2. Add details 3. Display details 4. User management 5. Display passenger details 6. Return to main menu If password doesn’t match X B C D E F
  • 22. B HERE BEGIN LOOP FOR ACCEPTING TRAIN DETAILS ADD TRAIN DETAILS SAVE DETAILS TO FILE (t.txt) HERE LOOP WILL BE STOP FOR ACCEPTING RECORD X
  • 23. C HERE BEGIN LOOP FOR ACCEPTING NEW TRAIN DETAILS ACCEPT TRAIN DETAILS SAVE DETAILS PREVIOUS FILE HERE LOOP WILL BE STOP FOR ACCEPTING RECORD X
  • 24. D HERE BEGIN LOOP FOR SHOWING TRAIN DETAILS START LOOP. AFTER SHOWING DETAILS. IT WILL BE STOP X DISPLAY RECORDS ONE BY ONE
  • 25. E 1. Create id 2. Add new details 3. Show details 4. Return to previous mode P X R Q
  • 26. P THEN AGAIN START LOOP FOR ANOTHER ID & PASSWORD CREATE USER ID SAVE FOR USER MANAGEMENT SYSTEM S CREATE USER PASSWORD CONFIRMATION SAVE DETAILS CONFIRMATION START LOOP X
  • 27. Q START LOOP CREATE USER ID SAVE TO USER FILE CREATE USER PASSWORD LOOP WILL BE STOP X
  • 28. R HERE BEGIN LOOP FOR SHOWING TRAIN DETAILS START LOOP. AFTER SHOWING DETAILS. IT WILL BE STOP X DISPLAY USER ID AND PASSWORD ONE BY ONE
  • 29. START 2. USER MODE NEED USER PASSWORD STOP 1. Reserve 2. Cancel 3. Enquiry 4. Return to previous mode Y M N O S NEED USER ID
  • 30. M Y 1. Reserve seat 2. Return to previous mode 1. Train no 2. Train name 3. Boarding point 4. Destination point 5. No of seats required START LOOP FOR ACCEPTING DETAILS K W
  • 31. SEARCH FOR AVAILABLE TRAINS W SHOW ALL THE AVAILABLE TRAINS NOT AVAILABLE TRAIN If train record found If train record not found V
  • 32. V ACCEPT TRAIN NUMBER SEARCH FOR AVAILABLE TRAINS ACCEPT NUMBER OF PASSENGER CANNOT REQUIRED Y R
  • 33. R ACCEPT CLASS INCORRECT CLASS CANNOT BOOK REQUIRED TICKETS Y READ FILE SAVE BOOKING DETAILS INFO FILE START LOOP TO ACCEPT PASSENGER LOOP ACCEP PASSENGER DETAILS V
  • 34. V SAVE DETAILS TO FILE STOP LOOP TO ACCEPT PASSENGER LOOP SHOW BOOKING DETAILS Y 1. Military 2. Senior citizen 3. Children age below 5 4. None User have to select any category
  • 35. START N ACCEPT PNR NUMBER READ FROM FILE SHOW BOOKING DETAILS T INVALID PNR IF PNR doesn’t match STOP Y
  • 37. 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; float tamt; class login { public: char id[100]; char pass[100]; char *password; void getid(){ cout<<"Please enter your id:"; 01
  • 38. gets(id); password=getpass("Please enter the password:"); strcpy(pass,password); } void displayid(){ cout<<"Id:"; puts(id); cout<<"Password:"; puts(pass);} }; 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(){ cout<<"Enter the details as followsn"; cout<<"Train no:"; cin>>tno; 02
  • 39. 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(){ 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]; 03
  • 40. char bp[10]; char dest[100]; char pname[10][100]; int age[20]; char clas[10]; int nosr; int i; int d,m,y; int con; float amc; void getresdet() { cout<<"Enter the details as followsn"; 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; 04
  • 41. 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 categoryn"; cout<<"1.Militaryn2.Senior citizenn"; cout<<"3.Children below 5 yrsn4.Nonen"; cin>>con; cout<<"............END OF GETTING DETAILS............n"; } void displayresdet(){ cout<<"...............................................n"; cout<<"...............................................n"; cout<<"Pnr no:"<<pnr; cout<<"nTrain no:"<<tno; cout<<"nTrain name:"; puts(tname); cout<<"Boarding point:"; 05
  • 42. 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]; 06
  • 43. char pname[10][100]; int age[20]; int i; char clas[10]; int nosc; int d,m,y; float amr; void getcancdet(){ cout<<"Enter the details as followsn"; cout<<"Pnr no:"; cin>>pnr; cout<<"Date of cancellation:"; cin>>d>>m>>y; cout<<"...........END OF GETTING DETAILS...........n"; } void displaycancdet(){ 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); 07
  • 44. 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; cout<<"-------------------------------------------------n"; cout<<".........WELCOME TO RAILWAY RESERVATION SYSTEM..........n"; cout<<"--------------------------------------------------n"; 08
  • 45. do{ cout<<"~~~~~~~~~~~~~~~~~~~~~~MAIN MENU~~~~~~~~~~~~~~~~n"; cout<<"Press 1. Administration modenPress 2.User modenPress 3.Exit the Applicationn"; cout<<"Please enter your option:"; cin>>ch; cout<<endl; switch(ch) { case 1: database(); break; case 2: user(); break; case 3: exit(0);}} while(ch<=3); getch();} void database(){ char *password; char *pass="nafiz#"; password=getpass("Enter the admininistrator password:"); detail a; fstream f; 09
  • 46. int ch; char c; if(strcmp(pass,password)!=0){ cout<<"Please enter the correct admininistrator password: n"; cout<<"You cannot login here. Thank youn"; goto h;} if(strcmp(pass,password)==0) { char c; do { cout<<"...........ADMINISTRATOR MENU...........n"; cout<<"Press 1.To create new filenPress 2.Add new detailsn"; cout<<"Press 3.Show detailsnPress 4.User id & password moden"; cout<<"Press 5.Show passenger detailsnPress 6.Return to previous moden"; cout<<"Please enter your option: "; cin>>ch; cout<<endl; switch(ch){ case 1: f.open("t.txt",ios::out|ios::binary); do{ a.getdetail(); f.write((char *) & a,sizeof(a)); cout<<"Do you want to add one more record?n"; cout<<"y-for Yes andnn-for Non"; cin>>c; } 10
  • 47. while(c=='y'); f.close(); break; case 2: f.open("t.txt",ios::in|ios::out|ios::binary|ios::app); a.getdetail(); f.write((char *) & a,sizeof(a)); f.close(); break; case 3: f.open("t.txt",ios::in|ios::out|ios::binary|ios::app); f.seekg(0); while(f.read((char *) & a,sizeof(a))) { a.displaydetail(); } f.close(); break; case 4: manage(); break; case 5: displaypassdetail(); break; }} while(ch<=5); f.close();} h:} void reserve(){ int ch; 11
  • 48. do{ cout<<"Press 1.Reserve seatnPress 2.Return to previous moden"; cout<<"Please enter your option: "; 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; f1.open("t.txt",ios::in|ios::out|ios::binary); f2.open("p.txt",ios::in|ios::out|ios::binary|ios::app); int ch; b.getresdet(); while(f1.read((char *) &a,sizeof(a))) { if(a.tno==b.tno) { if(strcmp(b.clas,f)==0) { if(a.c1>=b.nosr) { amt=a.c1fare; addr=f1.tellg(); 12
  • 49. ad=sizeof(a.c1); f1.seekp(addr-(7*ad)); a.c1=a.c1-b.nosr; f1.write((char *) & a.c1,sizeof(a.c1)); if(b.con==1) { cout<<"Category:Government peoplen"; b.amc=b.nosr*((amt*50)/100); } else if(b.con==2) { cout<<"Category:Disabled peoplen"; b.amc=b.nosr*((amt*60)/100); } else if(b.con==3) { cout<<"Category:Children under age fiven"; b.amc=0.0; } else if(b.con==4) { cout<<"You cannot get any categoryn"; b.amc=b.nosr*amt; } srand((unsigned) time(&t)); b.pnr=rand(); f2.write((char *) & b,sizeof(b)); b.displayresdet(); cout<<"------------------------------------------------------n"; cout<<"--------------Your ticket is reserved-----------n"; cout<<"-----------------End of reservation menu-------n"; } else { cout<<"**********Oh! sorry request seats not available***************n";} } else if(strcmp(b.clas,s)==0) { if(a.c2>=b.nosr){ 13
  • 50. amt=a.c2fare; addr=f1.tellg(); ad=sizeof(a.c2); f1.seekp(addr-(5*ad)); a.c2=a.c2-b.nosr; f1.write((char *) & a.c2,sizeof(a.c2)); if(b.con==1) { cout<<"Category:Government peoplen"; b.amc=b.nosr*((amt*50)/100); } else if(b.con==2) { cout<<"Category:Disabled peoplen"; b.amc=b.nosr*((amt*60)/100); } else if(b.con==3) { cout<<"Category:Children under age fiven"; b.amc=0.0; } else if(b.con==4) { cout<<"You cannot get any categoryn"; b.amc=b.nosr*amt; } f2.write((char *) & b,sizeof(b)); b.displayresdet(); cout<<"---------------------------------------n"; cout<<"--------Your ticket is reserved--------n"; cout<<"------------End of reservation---------n";} else{ cout<<"**********Oh! sorry request seats not available***************n";} } getch(); goto h;} else{ flag=0;}} 14
  • 51. if(flag==0) { cout<<"...................You press wrong train no......................n"; cout<<"......Please enter the train no from the data base.....n"; } f1.close(); f2.close(); getch(); h:} void displaypassdetail(){ fstream f; reser b; f.open("p.txt",ios::in|ios::out|ios::binary); f.seekg(0); while(f.read((char *) & b,sizeof(b))) { b.displayresdet(); } f.close(); getch();} void enquiry(){ fstream f; f.open("t.txt",ios::in|ios::out|ios::binary); detail a; while(f.read((char *) & a,sizeof(a))) { a.displaydetail(); } getch();} void cancell(){ detail a; reser b; canc c; fstream f1,f2,f3; 15
  • 52. f1.open("t.txt",ios::in|ios::out|ios::binary); f2.open("p.txt",ios::in|ios::out|ios::binary); f3.open("cn.txt",ios::in|ios::out|ios::binary); cout<<"**********CANCELLATION MENU*********n"; c.getcancdet(); while(f2.read((char *) & b,sizeof(b))) { if(b.pnr==c.pnr) { c.tno=b.tno; strcpy(c.tname,b.tname); strcpy(c.bp,b.bp); strcpy(c.dest,b.dest); c.nosc=b.nosr; for(int j=0; j<c.nosc; j++) { strcpy(c.pname[j],b.pname[j]); c.age[j]=b.age[j]; } strcpy(c.clas,b.clas); if(strcmp(c.clas,f)==0){ while(f1.read((char *) & a,sizeof(a))) { if(a.tno==c.tno) { a.c1=a.c1+c.nosc; d=a.d; m=a.m; addr=f1.tellg(); ad=sizeof(a.c1); f1.seekp(addr-(7*ad)); f1.write((char *) & a.c1,sizeof(a.c1)); tamt=b.amc; 16
  • 53. if((c.d==d)&&(c.m==m)) { cout<<"You are cancelling at the date of departuren"; c.amr=tamt-((tamt*60)/100); } else if(c.m==m) { cout<<"You are cancelling at the month of departuren"; c.amr=tamt-((tamt*50)/100); } else if(m>c.m) { cout<<"You are cancelling one month before the date of departuren"; c.amr=tamt-((tamt*20)/100); } else { cout<<"Cancelling after the departuren"; cout<<"Your request cannot be completedn";} goto h; c.displaycancdet();}} } else if(strcmp(c.clas,s)==0) { while(f1.read((char *) & a,sizeof(a))) { if(a.tno==c.tno) { a.c2=a.c2+c.nosc; d=a.d; m=a.m; addr=f1.tellg(); ad=sizeof(a.c2); f1.seekp(addr-(5*ad)); f1.write((char *) & a.c2,sizeof(a.c2)); tamt=b.amc; if((c.d==d)&&(c.m==m)) { cout<<"You are cancelling at the date of departuren"; c.amr=tamt-((tamt*60)/100); } 17
  • 54. else if(c.m==m) { cout<<"You are cancelling at the month of departuren"; c.amr=tamt-((tamt*50)/100); } else if(m>c.m) { cout<<"You are cancelling one month before the date of departuren"; c.amr=tamt-((tamt*20)/100); } else { cout<<"Cancelling after the departuren"; cout<<"Your request cannot be completedn"; } goto h; c.displaycancdet(); } } } } else { flag=0; } } h: if(flag==0) { cout<<"Enter the correct pnr non"; } f1.close(); f2.close(); f3.close(); getch();} void can(){ int ch; do { cout<<".................CANCELLATION MENU.........n"; cout<<"Press 1.CancelnPress 2.Return to previous moden"; cout<<"Please enter your option: "; cin>>ch; cout<<endl; switch(ch) { case 1: 18
  • 55. cancell(); break; } } while(ch==1); getch();} void user(){ login a; int ch; cout<<"*****************************************************n"; cout<<"***********WELCOME TO THE USER MENU**************n"; cout<<"****************************************************n"; char *password; fstream f; f.open("id.txt",ios::in|ios::out|ios::binary); char id[100]; puts("Please enter your id:"); gets(id); password=getpass("Please enter your password:"); while(f.read((char *) & a,sizeof(a))){ if((strcmp(a.id,id)==0)&&(strcmp(a.pass,password)==0)) { do { cout<<"Press 1.ReservenPress 2.CancelnPress 3.EnquirynPress 4.Return to previous moden"; cout<<"Please enter your option: "; cin>>ch; cout<<endl; switch(ch) { case 1: reserve(); break; case 2: cancell(); break; case 3: enquiry(); break; } } while(ch<=3); goto j; } 19
  • 56. else { d=1;} } if(d==1) { cout<<"Please enter your user id and password correctlyn"; } getch(); j:} void manage(){ int ch; fstream f; char c; login a; cout<<".........WELCOME TO THE USER MANAGEMENT MENU........n"; do { cout<<"Press 1.Create idn2.Add new detailsn"; cout<<"Press 3.Show detailsnPress 4.Return to previous moden"; cout<<"Please enter your option:"; cin>>ch; cout<<endl; switch(ch){ case 1: f.open("id.txt",ios::out|ios::binary); do { a.getid(); f.write((char *) & a,sizeof(a)); cout<<"Do you want to add one more record?n"; cout<<"y-Yes and nn-Non"; cin>>c;} 20
  • 57. while(c=='y'); f.close(); break; case 2: f.open("id.txt",ios::in|ios::out|ios::binary|ios::app); a.getid(); f.write((char *) & a,sizeof(a)); f.close(); break; case 3: f.open("id.txt",ios::in|ios::out|ios::binary); f.seekg(0); while(f.read((char *) & a,sizeof(a))) { a.displayid(); } f.close(); break; } } while(ch<=3); getch();} 21
  • 59. OUTPUT After complete this code. Press→ CTRL + F9
  • 73. ADVANTAGES AND DISADVANTAGES Advantage 1. Railway Reservation System provide greater through-put for better management of stocks. 2. Through the system we can manage the tickets reservation in better way and more efficiently. 3. We can increase the sales by reducing processing of tickets reservation in less time. 4. We can avoid manual mistake and user-defined problems. 5. We can also decrease manpower and increase the revenue. Disadvantage 1. It increases unemployment. 2. As it is not so big application but it needs a specific user to use it.
  • 74. BIBLIOGRAPHY HELP FROM THESE BOOKS: 1. A First Book of ANSI C – Gary J. Bronson 2. The C++ Programming Language- Bjarne Stroustrup 3. A Practical Introduction to Data Structures and Algorithm Analysis- Clifford A. Shaffer HELP FROM INTERNET: 1. www.wikipedia.com 2. www.stackoverflow.com 3. www.webopedia.com 4. www.programiz.com 5. https://www.cppbuzz.com/programs/c++/c++-programs
  • 75. Thank you so much