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.
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
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
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
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
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
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