Priyanka Tripathy
Priyanka Tripathy
Priyanka Tripathy
COLLEGE
KENDRAPARA
DEPARTMENT OF
COMPUTER SCIENCE
SYNOPSIS OF MINOR PROJECT ON
BACHELOR IN SCIENCE
(COMPUTER SCIENCE)
BY
PRIYANKA TRIPATHY
+3 3RD YEAR SCIENCE
ROLL NO. : BS21-255
Under the guidance of
Mr. JYOTI PRAKASH KAR
Lect. In DEPARTMENT OF COMPUTER SCIENCE
DECLARATION
(Priyanka Tripathy)
ABSTRACT
This Railway ticket reservation system should be able to manage all the
reservation-related functions. The online reservation System is derived from
GDS (Global system) also known as CRS Computer Reservation System). The
online reservation system has its database centrally located which is awessed
through an application programming interface (API) with the invention of the
online reservation System. The traveler and the railway got the freedom to
book a seat. anywhere at any time at their Convenience.
AGENDA
In our country India, there are number of counters for the reservation of the
seats and one can easily make reservations and get tickets. Then this project contains
entity relationship model diagram based on railway reservation system and
introduction to relation model There is also design of the database of the railway
reservation system based on relation model.
1
OBJECTIVE
The main objective of the railway ticket reservation System. Ticket is to
manage the details of train, booking, payment, seat, ticket. It manages all the info
about Train, Customers, Ticket. The purpose of the project is to build an application
program to reduce the manual work for the managing fort train booking, Customer
payment. It tracks all the details and provide to the Customer.
The objective of the railway ticket reservation system basis to design software
to fully automate the process of issuing a railway ticket. That is: -
1. TRAIN DETAILS
2. UPDATE TRAIN DETAILS
3. RESERVING A TICKET
4. CANCELLING A TICKET
5. DISPLAY THE PRESENT TICKET STATUS
2
HARDWARE AND SOFTWARE REQUIREMENT
HARDWARE REQUIREMENT
500 MHZ or above
PIV 512 MB RAM
1 GB hard disk space
SOFTWARE REQUIREMENT
OS-XP, Vista, Windows 7
Database – MS Access
Language – C++
Compiler- Turbo C++
3
PROJECT MODULE
The Train Ticket Booking Management Project Consists of three primary modules:
1. User Module- The user module is designed for passengers to book tickets
online. It enables user to create an account, search for trains, check
availability, book tickets, and make payments. User can also view their booking
history, cancel tickets, and print e-tickets
4
SYSTEM DESIGN: -
In the project, we have presented the railway ticket reservation system using ER
Diagram, data flow Diagram and Architecture and much more.
ER DIAGRAM: -
5
DATAFLOW DIAGRAM: -
6
FIRST LEVEL DFD: -
7
SOURCE CODE
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string.h>
#include <time.h>
using namespace std;
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[10];
void getid()
{
cout << "\nEnter your id:";
std::cin >> id;
std::cout << "Enter the Password: ";
std::cin >> password;
std::cout << "\n";
strcpy(pass,password);
}
void displayid()
{
std::cout << "\n" << "User ID:" << "\t" << "|" << "Password\n";
std::cout << "|" << id << "\t\t" << "|" << pass << "\n\n";
}
};
class Detail
{
8
public:
int tno;
char tname[100];
char bp[100];
char dest[100];
int c1,c1fare;
int c2,c2fare;
int d,m,y;
void getDetail()
{
Std::cout << "\n-Add New details--\n";
Std::cout << "Train no: ";
Std::cin >> tno;
Std::cout << "Train Name: ";
Std::cin >> tname;
Std::cout << "Boarding point: ";
Std::cin >> bp;
Std::cout << "Destination pt: ";
Std::cin >> dest;
Std::cout << "No of seats in first class & fare per ticket: ";
Std::cin >> c1 >> clfare;
Std::cout << "No of seats in second class & fare per ticket: ";
Std::cin >> c2 >> c2fare;
Std::cout << "Date of travel\n";
Std::cout << "Day: ";
Std::cin >> d;
Std::cout << "Month: ";
Std::cin >> m;
Std::cout << "Year: ";
Std::cin >> y;
}
Void displaydetail()
{
Std::cout << "\n Train No." << "\t" << "|Train Name" << "\t" << "|Boarding pt."
<< "\t" <<"|Destination pt." <<"\t";
9
Std::cout << "|F-Class" << "\t"<< "|F-Class Fare" << "\t" << "|S-Class" << "\
t"<<<"15-Class Fare" <<"\t";
Std::cout << "|Day" << "-" << "Month" << "-" << "Year" << "\n";
Std::cout << "/" << tno << "\t\t" << "|" << tname << "\t\t" << "/" << bp <<
"\t\t" << "/" << dest
<<"\t\t\t";
Std::cout << "|" << c1 << "\t\t" << "/"<< clfare << "\t\t" << "|" << c2<< "\t\
t" << "/" << c2fare
<<"\t\t";
Std::cout << "/" << d << "-" << m << "," << y << "\n";
}
};
Class reser
{
Public:
Int por:
Int tno;
Char tname(100);
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 follows\n";
Cout<<"Train no:";
Cin>>tno;
Cout<<"Train name:":
10
Cin>>tname;
Cout<<"Boarding point:";
Cin>>bp;
Cout<<"Destination pt:";
Cin>>dest;
Cout<<"No of seats required:";
Cin>>nost,
For(i=0;i<nosr;i++)
{
Cout<<"Passenger name:";
Std::cin >> pname[i];
Cout<<"Passenger age:";
Std::cin>>age[i];
}
Cout<<"Enter the class f-first class s-second class:";
Std::cin >> clas;
Cout<<"Date of travel:";
Std::cin>>d>>m>>y;
Cout<<"Enter the concession category\n";
Cout<<"1.Military\n2.Senior citizen\n";
Cout<<"3.Children below 5 yrs\n4. None\n";
Std::cin>>con;
Cout<<"END OF GETTING DETAILS\n";
}
Void displayresdet()
{
Cout<<"Pnr no: "<<pnr;
Cout<<"\nTrain no: "<<tno;
Cout<<"\nTrain name: "<<tname;
Cout<<"\nBoarding point: "<<bp;
Cout<<"\nDestination pt: "<<dest;
Cout<<"\nNo of seats reserved: "<<nost; For(i=0;i<nosr;i++)
{
Cout<<"\nPassenger name: ";puts(pname[i]);
Cout<<"Passenger age: "<<age[i];
}
11
Cout<<"\nYour class: ";puts(clas);
Cout<<"\nDate of reservation: "<<d<<"-"<<m<<"-"<<у;
Cout<<"\nYour concession category: "<<con;
Cout<<"\nYou must pay: "<<amc<<endl;
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()
{
Std::cout << "Enter the details as follows\n";
Std::cout << "Pnr no:";
Std::cin >> pnr,
Std::cout << "Date of cancellation:";
Std::cin >> d >> m >> y;
Std::cout << "PPER.. END OF GETTING DETAILS223..\n";
}
Void displaycancdet()
{
Std::cout << "\n";
Std::cout << "RELLULESERLER.\n";
12
Std::cout << "Pnr no:" << pnr;
Std::cout << "\nTrain no:" << tno;
Std::cout << "\nTrain name:";
Std::cout << tname;
Std::cout << "Boarding point:";
Std::cout << bp;
Std::cout << "Destination pt:";
Std::cout << dest;
Cout << "\nYour class:":
Std::cout << clas;
Cout << "no of seats to be cancelled:" << nosc;
For (1=0; 1<nosc; I++)
{
Std::cout << "Passenger name:";
Std::cout << pname[i];
Std::cout << "passenger age:" << age[i];
}
Std::cout << "\nDate of cancellation:" << d << "-" << m << "-" << y;
Std::cout << "\nYou can collect:" << amr << "rs" << endl;
Std::cout <<
Std::cout << "22ZBEND OF CANCELLATION\n";
Std::cout <<”************************************\n”;
}
};
Void manage();
Void can():
Void user();
Void database();
Void res():
Void reserve();
Void displaypassdetail();
Void cancell();
Void enquiry();
Int main(void)
{
13
Int ch;
Std::cout << " RAILWAY RESERVATION SYSTEM\n";
Do
{
Std::cout << "\n MAIN MENU \n";
Std::cout << "1.Admin mode\n2.User mode\n3.Exit \n";
Std::cout << "Enter your choice: ";
Std::cin >> ch;
Switch(ch)
{
Case 1:
Database();
Break;
Case 2:
User();
Break;
Default:
Exit(0);
}
}while(ch<3);
Return 0;
}
Void database()
{
Char password [10];
Char pass[10]= "admin";
Std::cout << "\nEnter the Admin Password: ";
Std::cin >> password;
Detail a;
Fstream f;
Int ch;
Char c
If(strcmp(pass,password)!=0)
{
Std::cout << "Enter the password correctly \n";
14
Std::cout << "You are not permitted to login this mode\n";
}
If(strcmp(pass,password)==0)
{
Char c;
Do
{
Std::cout << "\n- ADMINISTRATOR MENU - \n";
Std::cout << "1. Create detail Database \n";
Std::cout << "2. Add details \n";
Std::cout << "3. Display details \n";
Std::cout << "4. User Management \n";
Std::cout << "5. Diplay Passenger details \n";
Std::cout << "6. Return to Main Menu \n";
Std::cout << "Enter your choice:";
Std::cin >> ch;
Switch(ch)
{
Case 1:
f.open("t.txt",los::out|los::binary);
do
{
a.getDetail();
f.write((char *) & a,sizeof(a));
cout << "\nDo you want to add one more record?\n";
cout << "y-for Yes\nn-for No\n";
cin >> c;
)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;
15
case 3:
f.open("t.txt", ios::in|los::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);
}
}
Void reserve()
{
Int ch;
Do
{
Std::cout << "1.Reserve\n2.Return to the main menu\n";
Std::cout << "Enter your choice:";
Std::cin >> ch;
Std::cout << endl;
Switch (ch)
{
Case 1:
Res();
Break;
}
16
} while (ch == 1);
}
Void res()
{
Detail a;
Reser b;
Fstream f1, f2;
Time_t t;
F1.open("t.txt", loszin | los:cout | los::binary);
F2.open("p.txt", ios::in | los::out | los::binary | los::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.clfare;
Addr=f1.tellg();
Ad = sizeof(a.c1);
F1.seekp(addr-(7 ad));
a.c1a.c1-b.nosr;
f1.write((char *)&a.c1, sizeof(a.c1));
if (b.con == 1)
{
Cout << "Concession category:MILITARY PERSONNEL\n"; b.amcb.nosr ((amt*50)/100);
}
Else if (b.con == 2)
{
Cout << "Concession category:SENIOR CITIZEN\n";
b.amcb.nosr ((amt 60)/100);
}
Else if (b.con == 3)
17
{
Cout << "Concession category:CHILDERN BELOW FIVE\n";
b.amc = 0.0;
}
Else if (b.con == 4)
{
Cout << "You cannot get any concession\n";
b.amcb.nosr amt;
}
Srand((unsigned)time(&t));
b.pnr = rand();
f2.write((char *)&b, sizeof(b));
b.displayresdet();
cout << "\n-----Your ticket is reserved----\n";
}
Else
{
Cout <<"****** *Sorry req seats not available********\n";
}
}
Else if (strcmp(b.clas, 3)==0)
{
if (a.c2> b nosr)
{
Amta.c2fare;
Addr 11.tellg(); Ad sizeof(a.c2); Fl.seekpladdr-15ad));
a.c2a.c2-b.nosr;
f1.write((char *)&a.c2, sizeof(a.c2));
if (b.con== 1)
{
Cout << "Concession category:MILITARY PRESONNEL\n";
b.amcb.nost ((amt*50)/100);
}
Else if (b.con == 2)
{
Cout << "Concession category:SENIOR CITIZEN\n";
18
b.amcb.nosr ((amt 60)/100);
}
Else if (b.con == 3)
{
Cout << "Concession category:CHILDERN BELOW FIVE\n";
b.amc = 0.0;
}
Else if (b.con == 4)
{
Cout << "You cannot get any concession\n";
Flag = 0;
}
}
H:
If(flag==0)
{
Cout << "Enter the correct pnr no\n";
}
F1.close();
F2.close();
F3.close();
}
Void can()
{
Int ch;
Do
{
Cout << "..CANCELLATION MENU222\n";
Cout << "1.Cancel\n2. Return to the main menu\n";
Cout << "Enter your choice:";
Cin >> ch;
Cout << endl;
Switch (ch)
{
Case 1:
Cancell();
19
Break;
}
} while (ch == 1);
}
Void user()
{
Login a;
int ch;
Cout<<"\n-Login User-\n";
Char password [10];
Fstream f;
f.open("id.txt",ios::in |ios::out | ios::binary);
char id[100];
std::cout << "Enter your ID: ";
std::cin >> id;
std::cout << "Enter your Password: ";
std::cin >> password;
while(f.read((char *) & a,sizeof(a)))
{
If((strcmp(a.id,id)==0)&&(strcmp(a.pass,password)==0))
{
Do
{
Std::cout<<"\n1.Reserve\n2.Cancel\n3.Enquiry\n4. Return to
the main menu \n";
Cout<<"Enter your choice:";
Cin>>ch;
Switch(ch)
{
Case 1:
Reserve():
Break;
Case 2:
Cancell();
Break;
Case 3:
20
Enquiry();
Break;
}
}while(ch<=3);
}
Else
{
D=1;
}
}
if(d==1)
{
Cout<<"Enter your user id and password correctly\n";
}
}
Void manage()
{
int ch;
Fstream f;
Char c;
Login a;
Std::cout<<"\n-WELCOME TO THE USER MANAGEMENT MENU--\n";
Do
{
Std::cout << "1. Create id database\n";
Std::cout << "2. Add details\n";
Std::cout << "3. Display details\n";
Std::cout << "4. Return to the main menu\n";
Std::cout << "Enter your choice: ";
Std::cin>>ch;
Switch(ch)
{
Case 1:
f.open("id.txt",ios::out | ios::binary);
do
{
21
a.getid();
f.write((char *) & a,sizeof(a));
std::cout << "Do you want to add one more record\n";
std::cout << "y-Yes\nn-No\n";
std::cin>>c;
}while(c == 'y');
f.close();
break;
case 2:
f.open("id.txt", ios::in|los::out|los::binary|los::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);
}
22
OUTPUT
MAIN MENU
1. Admin mode
2. User Mode
3. Exit
Enter YOUR CHOICE: 1
Enter the admin password: admin
23
ADMINISTRATOR MENU: -
1. Create detailed database
2. Add details
3. Display details
4. User management
5. Display passenger details
6. Return to main menu
Enter your choice: 4
24
WELCOME TO THE USER MANAGEMENT MENU:
1. Created database
2. Add details
3. Display details
4. Return to the main menu
Enter your choice: 1
25
Enter your Id: 101
Enter your password: sony12
Do you want to add one more record
y- yes
n- no
y
26
Enter your Id: 102
Enter your password: sony34
Do you want to add one more record
y- yes
n- no
n
27
1. Create id database
2. Add details
3. Display details
4. Return to the main menu
Enter your choice: 4
28
ADMINISTRATOR MENU: -
1. Create details database
2. Add details
3. Display details
4. User management
5. Display passengers’ details
6. Return to main menu
Enter your choice: 2
29
ADD NEW DETAILS:
Train no: 8902
Train Name: Nilachal Express
Boarding point: Kolkata
No. of seats in the first class & fare per ticket: 320 1500
No. of seats in the second class & fare per ticket:290 890
Date of travel
Day:23
Month: 04
Year: 2024
30
ADMINISTRATOR MENU:
1.create details database
2.Add details
3.Display details
4.User Management
5.Display passenger Details
6.return to main menu
Enter your Choice: 2
31
ADD NEW DETAILS:
Train no: 5678
Train name: Rajadhani Express
Boarding point: BBSR
Destination point: Delhi
No of seats in first class & fare per ticket: 250 1850
No of seats in second class & fare per ticket:210 930
Date of travel
Day: 25
Month: 04
Year: 2023
32
ADMINISTRATOR MENU:
1.create details database
2.Add details
3.Display details
4.User Management
5.Display passenger Details
6.return to main menu
Enter your Choice: 6
33
MAIN MENU
1. Admin mode
2. User mode
3. Exit
ENTER YOUR CHOICE:2
34
Login User:
Enter your ID: 101
Enter your password: sony12
1. Reserve
2. Cancel
3. Enquiry
4. Return to the main menu
Enter your Choice: 1
35
1. Reserve
2. Return to main menu
Enter your choice: 1
36
CONCLUSION
The railway ticket reservation is a complex activity because of sheer
volumes and type of coaches etc. also transaction has a good variety. So, the
CRIS and 3 tires sever client architecture. It has proved to a boom not only
passengers but also for railways functioning since, it generates all the
reports necessary for optimization and decision-making. It is a real time
passenger reservation system.
37
REFERENCE
The following books were referred during the analysis and execution
phase of the project:
1. Object Oriented Programming in C++, Kalyani Publisher
2. E. Balguruswawmy, Object Oriented Programming with C++
3. Bjarne Stroustroup, Programming principles and practice using C++/e,
Addison- Wesley 2014
4. WEBSITES:
https://indianrailways.gov.in/railwayboard/uploads/directorate/cis/
Progress_of_IT_projects_CSIR.pdf
https://www.freeprojectz.com/project-source-code-database-
download/railway-reservation-system-project
https://www.geeksforgeeks.org/railway-reservation-system-in-c/
38