0% found this document useful (0 votes)
181 views64 pages

Minor Project

kkkkk

Uploaded by

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

Minor Project

kkkkk

Uploaded by

Divyesh Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 64

UNIVERSITY INSTITUTE OF TECHNOLOGY

BARKATULLAH UNIVESITY, BHOPAL


Department of Computer Science & Engineering

MINOR PROJECT
ON
“RAILWAY RESERVATION SYSTEM”
Submitted for the partial fulfillment of the requirement for the

Award of Degree of

Bachelor of Engineering (B.E.)

Year 2018

University Institute of Technology

Barkatullah University, Bhopal

By

Aditya Shukla Divyesh K Dubey Abhishek Kushwah Rajeev Chetan

Under the Guidance

Of

Ms. S. Almelu Dr. Taruna Jain

Asst. Professor Head of Department

CSE, UIT-BU CSE, UIT-BU


UNIVERSITY INSTITUTE OF TECHNOLOGY
BARKATULLAH UNIVESITY, BHOPAL
Department of Computer Science & Engineering

CERTIFICATE

YEAR 2018

This is to certify that Mr. Aditya Shukla, Mr. Divyesh Dubey, Mr. Abhishek
Kushwah & Mr. Rajeev Chetan have successfully completed this project work
titled “RAILWAY RESERVATION SYSTEM” for the partial fulfillment of the
award of degree of Bachelor of Engineering in Computer Science & Engineering
in the year 2018-19 Barkatullah University Institute of Technology, Bhopal.

Ms. S. Almelu Dr. Taruna Jain

Asst. Professor Head of Department Director

CSE, UIT-BU CSE, UIT-BU UIT-BU (Bhopal)


UNIVERSITY INSTITUTE OF TECHNOLOGY
BARKATULLAH UNIVESITY, BHOPAL
Department of Computer Science & Engineering

DECLARATION

YEAR 2018

We hereby declare that the work which is being presented in this report entitled, “RAILWAY
RESERVATION SYSTEM” submitted in partial fulfillment of the requirement for the award of
Degree of “Bachelor of Engineering” in Computer Science and Engineering from University of
Technology, BU, Bhopal is an authentic record of our project work carried out under the
Guidance of Ms. S. Almelu, Asst. Professor UIT-BU, Bhopal.

This is our original work and has not been submitted earlier for the award of any other degree,
diploma or any other certificate.

ADITYA SHUKLA DIVYESH DUBEY

(168230087) (168230102)

ABHISHEK KUSHWAH RAJEEV CHETAN

(168230086) (178230260)
ACKNOWLEDGMENT

We would like to express our deepest appreciation to all those who provided us the possibility to
complete this report.

Before we get into the thick of the things we would like to add a few heartfelt words for the
teachers who are part of this project in a numerous way. Teacher who gave us support right from
the project idea were convinced.

First of all we would like to thanks out project guide Miss. S. Almelu for allowing us to undergo
this minor project idea. We would also like to pay our sincere regards to our honorable HOD Dr.
Taruna Jain for providing effective platform and support in the development of this project and
finally we would like to render our thanks to our honorable Director for his guidance in this
project titled “RAILWAY RESERVATION SYSTEM”.

Last but not the least we would like to thank our parent and friends for their support and
cooperation. Regardless of the source we wish to express our gratitude to those who may have
contributed to this work; even though anonymously.
ABSTRACT

The Indian Railways(IR) carries about 5.5 lacs passengers in reserved accommodation every day.
The Computerized Passenger Reservation System(PRS) facilitates the booking and cancellation
of tickets from any of the 4000 terminals (i.e. PRS booking window all over the countries).
These tickets can be booked or cancelled for journeys commencing in any part of India and
ending in any other part, with travel time as long as 72 hours and distance upto several thousand
kilometers.

In the given project we will be developing a console application which will help users to find
train details, book and cancel tickets and the exact rates of their tickets to the desired destination.

The booking database has passenger’s details like Name, Age, Gender, Mobile Number,
Address, Train number, Class of Travel, From, To, Fare, Arrival Time, Departure Time.

The train database has train details like Train Number, From, To, First Class fare, Second class
fare, Arrival time and Departure time.

The Railway Reservation system is software for the purpose of reserving train seats at any time.
This application provides us complete information about a train between specified source and
destination. This application gives current status of reservations of particular train, fares for
different classes of train and also waiting status. For this application, a traveler must visit the
counter. In this system, train records are maintained and retrieved. Administrator monitors all
users and their transactions. Administrator has complete access to database and can add train or
cancel train.
LIST OF FIGURES

S.No. Page No. Figure Name Page No.


1
2
3
4
5
6
7
8
9
10
LIST OF TABLES

S.No. Table Number Table Name Page No.


1 Table 1.1 Available Options
LIST OF ABBREVIATIONS

1. IR Indian Railways
2. RRS Railway Reservation System
3. SRS Software Requirement Specification
4. MTTR Mean Time to Repair
CHAPTER 1
INTRODUCTION TO PROJECT

1.1. About Indian Railway:

Indian Railways is an Indian state-owned enterprise, owned and operated by the


government of India through the Ministry of Railways. It is one of the world’s
largest railway networks comprising 115,000 km (71,000 mi) of track over a route
of 65,000 km (40,000 mi) and 7,500 stations. As of December 2013, it transported
over 25 million passengers daily (over 9 billion on an annual basis). In 2011, IR
carried over 8,900 million passengers annually or more than 24 million passengers
daily (roughly half of which were suburban passengers) and 2.8 million tons of
freight daily. In 2011-2012 Indian Railways had revenues of Rs. 1119848.9
million (US$17 billion) which consists of Rs. 696759.7 million (US$ 11 billion)
from freight and Rs. 286455.2 million (US$4.4 billion) from passengers tickets.

Railways were first introduced to India in 1853 from Bombay to Thane. In 1951
the systems were nationalized as one unit, the Indian Railways, becoming one of
the largest networks in the world. IR operates both long distance and suburban rail
systems on a multi-gauge network of broad, metre and narrow gauges. It also owns
locomotive and coach production facilities at several places in India and are
assigned codes identifying their gauge, kind of power and type of operation. Its
operations cover twenty eight states and seven union territories and also provide
limited international services to Nepal, Bangladesh and Pakistan.

Indian Railways is the world’s ninth largest commercial or utility employer, by


number of employers, with over 1.4 million employees. As for rolling stock, IR
holds over 239,281 Freight Wagons, 59,713 Passenger Coaches and 9,549
Locomotives (43 steam, 5,197 diesel and 4,309 electric locomotives). The trains
have a 5 digit numbering system as the Indian Railways runs about 10,000 trains
daily. As of 31 March 2013, 23,541 km (14,628 mi) (36%) of the total 65,000 km
(40,000 mi) route length was electrified. Since 1960, almost all electrified sections
on IR use 25,000 Volt AC traction through overhead catenary delivery.
1.2. OUR PROJECT:

This system is basically concerned with the reservation and cancellation of railway
tickets to the passengers. The need of this system arose because as is the known
fact that India has the largest railways network in the whole of the world and to
handle it manually is quite a tough job. By computerizing it, we will be able to
overcome many of its limitations and will be able to make it more efficient. The
handling of data is a very complex task if done manually but it can be made much
easier if the system is computerized.

This project introduces railway reservation system. It explains how reservation is


being done in Indian Railways. The step by step procedure is explained. This
project is developed in c language. Various header files have been used in this
project. Proper comments have been given at desired locations to make the project
user friendly.

Choice No Description
1 View list of trains
2 Book ticket
3 View ticket through ticket number
4 Search ticket number by mobile number
5 View all booking
6 View Train Booking
7 Cancel Train
8 Cancel Ticket
9 Exit from the system
Table 1.1 Available Options
CHAPTER 2

REQUIREMENTS

Here we will discuss and analyze about the developing process of Railway Reservation System
including SRS. The functional and non-functional requirements are included in SRS part to
provide complete description and overview of system requirement before the developing process
carried out.

2.1 SOFTWARE REQUIREMENT SPECIFICATION


2.1.1 GENERAL DESCRIPTION
PRODUCT DESCRIPTION:
Railway Reservation System is a computerized system, which helps administrator to manage the
daily activity in electronic format. It reduces the risk of paper work such as paper lost, paper
damaged and time consuming. It can help administrator to manage the transaction of record more
effectively and time saving.

PROBLEM STATEMENT:
The problem occurred before having computerized system includes:

 File lost – When computerized system not implemented file is always lost because of
human environment. Sometimes due to some human error, there may be a loss of records.
 Difficult to search record – When there is no computerized system there is always a
difficulty in searching of records if the records are large in number.
 Space consuming – After the number of records become large the space for physical
storage of file and records also increases if no computerized system is implemented.
 Cost Consuming – As there is no computerized system to add each record paper needed
which will increase the cost for the management of library.
2.1.2 SYSTEM OBJECTIVES
 The objective of railway reservation system is to give structural design to railway system.
 After computerized system is implemented less human force will be required to maintain
the reservation and cancellation thus reducing the overall cost.
 Admin is able to search record by using few clicks of mouse and few search keywords
thus saving his valuable time.
 This project also provides a complete set of solutions for some common and specific area
as of work in the railways.

2.2 SOFTWARE AND HARDWARE REQUIREMENTS


This section describes the software and hardware requirements of the system

2.2.1 SOFTWARE REQUIREMENTS

 Operating System- Windows 7 is used as the operating system as it is stable and supports
more features and is more user friendly.
 IDE and Programming language – C language is used to write the code and the
development application involved is Code::Blocks IDE.

2.2.2 HARDWARE REQUIREMENTS


 RAM 1 GB is used as it will provide fast reading and writing capabilities and will in turn
support in processing.
 Intel® Core™ 2 Duo CPU is used as a processor because it is faster than other processors
and provide reliable and stable and we can run our PC for long-time. By using this
processor, we can keep on developing our project without any worries.
CHAPTER 5

CODING
#include<stdio.h>

#include”conio2.h”

#include”rlyres.h”

#include<ctype.h>

#include<string.h>

#include<dos.h>

#include<time.h>

int enterchoice(){

gotoxy(30,2);

int choice,i;

textcolor(YELLOW);

printf(“RAILWAY RESERVATION SYSTEM \n”);

srand(time(NULL));

for(i=0;i<120;i++)

textcolor((rand()%14)+1);

printf(“**”);

textcolor(YELLOW);

printf(“\n1.View train”);

printf(“\n2.Book ticket”);
printf(“\n3.View ticket”);

printf(“\n4.Search ticket no.”);

printf(“\n5.View All booking”);

printf(“\n6.View train booking”);

printf(“\n7.Cancel train”);

printf(“\n8.Cancel ticket”);

printf(“\n9.Quit\n\n”);

for(i=0;i<120;i++)

textcolor((rand()%14)+1);

printf(“**”);

textcolor(YELLOW);

printf(“\n\nENTER YOUR CHOICE :- “);

scanf(“%d”,&choice);

return choice;

void add_trains()

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

if(fp == NULL)

Train alltrains[5]={

{“123”,”BPL”,”GWL”,2100,1500,”9:00”,”18:00”}, //myproject folder should be empty.


{“546”,”BPL”,”DEL”,3500,2240,”8:30”,”20:00”},

{“345”,”HBJ”,”AGR”,1560,1135,”7:00”,”14:00”},

{“896”,”HBJ”,”MUM”,4500,3360,”6:00”,”23:00”},

{“786”,”HYD”,”DEL”,6700,4600,”6:00”,”5:00”}

};

fp = fopen(“d:\\myproject\\alltrains.dat”,”wb”);

fwrite(alltrains,5 * sizeof(Train),1,fp);

//printf(“File saved 15uccessfully”);

fclose(fp);

else {

// printf(“File already present\n”);

fclose(fp);

void view_trains()

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

int i;

if(fp == NULL)

{ textcolor(LIGHTRED);

delay(100);

printf(“NO DATA FOUND”);


}

else

Train t;

textcolor(WHITE);

printf(“TRAIN NO..\tFROM\tTO\tFIRST AC\tSECOND AC\tArr\tDep\n”);

for(i=0;i<120;i++)

textcolor((rand()%14)+1);

printf(“**”);

textcolor(YELLOW);

while(fread(&t,sizeof(t),1,fp)==1)

printf(“\n”);

printf(“%s\t\t%s\t%s\t%d\t\t%d\t\t%s\t%s”,t.train_no,t.from,t.to,t.fac_fare,t.sac_fare,t.arrival,t.de
part);

printf(“\n\n”);

for(i=0;i<60;i++)

textcolor((rand()%14)+1);
printf(“**”);

fclose(fp);

int check_train_no(char *train_no)

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

Train t;

while(fread(&t,sizeof(t),1,fp)==1)

if(strcmp(t.train_no,train_no)==0)

fclose(fp);

return 1;

fclose(fp);

return 0;

int check_mob_no(char *mob_no)

if(strlen(mob_no)!=10)

return 0;
while(*mob_no!=’\0’)

if(isdigit(*mob_no)==0)

return 0;

mob_no++;

return 1;

passenger* get_passenger_details()

gotoxy(100,1);

textcolor(LIGHTGREEN);

printf(“Press 0 to exit”);

gotoxy(1,1);

textcolor(YELLOW);

printf(“Enter passenger name :- “);

static passenger psn;

fflush(stdin);

fgets(psn.p_name,20,stdin);

char* pos;

pos = strchr(psn.p_name,’\n’);

*pos = ‘\0’;

if(strcmp(psn.p_name,”0”) == 0)

gotoxy(1,25);
textcolor(LIGHTRED);

delay(200);

printf(“RESERVATION CANCELLED!”);

return NULL;

printf(“Enter Gender(MALE-M/FEMALE-F) :- “);

while(1)

{fflush(stdin);

scanf(“%c”,&psn.gender);

gotoxy(1,25);

printf(“\t\t\t\t\t”);

if(psn.gender == ‘0’)

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“RESERVATION CANCELLED!”);

return NULL;

if(psn.gender!=’M’&&psn.gender!=’F’)

gotoxy(1,25);

printf(“\t\t\t\t\t\r”);

textcolor(LIGHTRED);

delay(200);
printf(“ERROR ! GENDER SHOULD BE ‘M’ OR ‘F’”);

gotoxy(1,2);

textcolor(YELLOW);

gotoxy(33,2);

printf(“ \b\b\b\b”);

else

gotoxy(1,25);

printf(“\t\t\t\t”);

gotoxy(1,3);

break;

printf(“Enter train no:-“);

while(1)

fflush(stdin);

fgets(psn.train_no,20,stdin);

char* p;

p = strchr(psn.train_no,’\n’);

*p = ‘\0’;

if(strcmp(psn.train_no,”0”) == 0)

{ //clrscr();

gotoxy(1,25);

printf(“\t\t\t\t\r”);
textcolor(LIGHTRED);

delay(200);

printf(“RESERVATION CANCELLED!”);

return NULL;

if(check_train_no(psn.train_no)==0)

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“ERROR ! NO SUCH TRAIN FOUND”);

textcolor(YELLOW);

gotoxy(17,3);

printf(“ \b\b\b\b\b\b”);

else

gotoxy(1,25);

printf(“\t\t\t\t”);

gotoxy(1,4);

break;

printf(“Enter age :-“);

while(1)
{fflush(stdin);

scanf(“%d”,&psn.age);

int x=isdigit(psn.age);

if(x!=0)

if(psn.age == 0)

//clrscr();

gotoxy(1,20);

textcolor(LIGHTRED);

printf(“\t\t\t\t\r”);

delay(200);

printf(“RESERVATION CANCELLED!”);

textcolor(YELLOW);

return NULL;

if(psn.age<0)

fflush(stdin);

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“ERROR ! AGE SHOULD BE POSITIVE”);

textcolor(YELLOW);

gotoxy(13,4);

printf(“ \b\b\b\b\b”);
}

else

gotoxy(1,25);

printf(“\t\t\t\t”);

gotoxy(1,5);

break;

break;

printf(“Enter Mobile no:-“);

while(1)

fflush(stdin);

fgets(psn.mob_no,20,stdin);

char* pon;

pon=strchr(psn.mob_no,’\n’);

if(pon!=NULL)

*pon=’\0’;

if(strcmp(psn.mob_no,”0”) == 0)

//clrscr();

gotoxy(1,25);

printf(“\t\t\t\t\t\t\t\r”);
textcolor(LIGHTRED);

delay(200);

printf(“RESERVATION CANCELLED!”);

textcolor(YELLOW);

return NULL;

if(check_mob_no(psn.mob_no)==0)

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“ERROR ! MOBILE NUMBER SHOULD HAVE ONLY 10 DIGITS AND SHOULD


BE NUMBERS”);

textcolor(YELLOW);

gotoxy(18,5);

printf(“\t \b\b\b\b\b\b\b\b\b\b\b\b\b\b”);

else

gotoxy(1,25);

printf(“\t\t\t\t\t\t\t\t\t\t”);

gotoxy(1,6);

break;

printf(“Enter class(FIRST-F/SECOND-S):-“);
while(1)

fflush(stdin);

scanf(“%c”,&psn.p_class);

if(psn.p_class == ‘0’)

clrscr();

gotoxy(1,25);

textcolor(LIGHTRED);

printf(“\t\t\t\t\r”);

delay(200);

printf(“RESERVATION CANCELLED!”);

textcolor(YELLOW);

return NULL;

if(psn.p_class!=’F’&&psn.p_class!=’S’)

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“Error ! NO SUCH CLASS FOUND”);

textcolor(YELLOW);

gotoxy(32,6);

printf(“ \b”);

else
{

gotoxy(1,25);

printf(“\t\t\t\t”);

gotoxy(1,7);

textcolor(YELLOW);

break;

printf(“Enter address:-“);

fflush(stdin);

fgets(psn.add,20,stdin);

char *por;

por = strchr(psn.add,’\n’);

if(por!=NULL)

*por = ‘\0’;

if(strcmp(psn.add,”0”)==0)

clrscr();

gotoxy(1,25);

textcolor(LIGHTRED);

printf(“\t\t\t\t\r”);

delay(200);

printf(“RESERVATION CANCELLED!”);

textcolor(YELLOW);

return NULL;
}

return &psn;

int get_booked_ticket_count(char *train,char cls)

FILE *fp = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

if(fp == NULL)

return 0;

int count = 0;

passenger psg;

while(fread(&psg,sizeof(passenger),1,fp))

if(strcmp(psg.train_no,train)==0 && psg.p_class==cls)

count++;

fclose(fp);

return count;

int last_ticket_no()

FILE *fp = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

if(fp == NULL)

return 0;

passenger psg;
while(fread(&psg,sizeof(passenger),1,fp));

fclose(fp);

return psg.ticket_no;

int book_ticket(passenger p)

int x = get_booked_ticket_count(p.train_no,p.p_class);

if(x == 30)

return -1;

int y = last_ticket_no() + 1;

FILE *fp = fopen(“d:\\myproject\\allbookings.dat”,”ab”);

if(fp == NULL)

exit(1);

p.ticket_no = y;

fwrite(&p,sizeof(passenger),1,fp);

fclose(fp);

return y;

void view_ticket(int ticket_no)

passenger psn;

Train tr;

int x = 0;

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);


FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

if(fp == NULL || fr == NULL)

{ textcolor(LIGHTRED);

gotoxy(1,25);

delay(200);

printf(“ERROR ! NO RECORD FOUND”);

return;

textcolor(LIGHTMAGENTA);

/*int i;

for(i=0;i<=119;i++)

printf(“**”);

*/

while(fread(&psn,sizeof(passenger),1,fr))

if(ticket_no == psn.ticket_no)

x = 1;

textcolor(LIGHTCYAN);

printf(“NAME:- %s\nGENDER:- %c\nTRAIN NO:- %s\nAGE:- %d\nMOBILE NO:-


%s\nCLASS:- %c\nTICKET NO:- %d\nADDRESS:-
%s\n”,psn.p_name,psn.gender,psn.train_no,psn.age,psn.mob_no,psn.p_class,psn.ticket_no,psn.a
dd);

while(fread(&tr,sizeof(Train),1,fp))

if(strcmp(psn.train_no,tr.train_no)==0)

if(psn.p_class == ‘S’)
printf(“FROM:- %s\nTO:-%s\nFARE:-%d\n”,tr.from,tr.to,tr.sac_fare);

else

printf(“FROM:- %s\nTO:-%s\nFARE:-%d\n”,tr.from,tr.to,tr.fac_fare);

break;

textcolor(YELLOW);

break;

if(x == 0 && ticket_no <= last_ticket_no() + 1)

textcolor(LIGHTRED);

printf(“TICKET NUMBER %d IS CANCELLED”,ticket_no);

textcolor(YELLOW);

fclose(fp);

fclose(fr);

return;

if(x == 0)

{
gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“INVALID TICKET NUMBER”);

textcolor(YELLOW);

fclose(fp);

fclose(fr);

int accept_ticket_no()

int ticket_no;

gotoxy(100,1);

textcolor(LIGHTGREEN);

printf(“Press 0 to exit”);

gotoxy(1,1);

textcolor(YELLOW);

printf(“Enter ticket no:- “);

while(1)

scanf(“%d”,&ticket_no);

if(ticket_no == 0)

gotoxy(1,25);
textcolor(LIGHTRED);

printf(“\t\t\t\t\r”);

delay(200);

printf(“CANCELLING PROCESS IS CANCELLED!”);

textcolor(YELLOW);

return 0;

if(ticket_no<0)

{ gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“TICKET NUMBER SHOULD BE POSITIVE”);

textcolor(YELLOW);

gotoxy(18,1);

printf(“ \b\b\b”);

else

gotoxy(1,25);

printf(“\t\t\t\t\t\t”);

gotoxy(100,1);

printf(“\t\t\t”);

gotoxy(1,2);

return ticket_no;
}

int cancel_ticket(int ticket_no)

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

FILE *fp = fopen(“d:\\myproject\\temp.dat”,”wb”);

if(fr == NULL)

printf(“NO BOOKINS DONE YET”);

return -1;

passenger psn;

int flag = 0;

while(fread(&psn,sizeof(passenger),1,fr))

if(psn.ticket_no != ticket_no)

fwrite(&psn,sizeof(passenger),1,fp);

else

flag = 1;
}

fclose(fr);

fclose(fp);

if(flag == 1)

remove(“d:\\myproject\\allbookings.dat”);

rename(“d:\\myproject\\temp.dat”,”d:\\myproject\\allbookings.dat”);

else

remove(“d:\\myproject\\temp.dat”);

fclose(fp);

fclose(fr);

return flag;

char * accept_train_no()

gotoxy(100,1);

textcolor(LIGHTGREEN);

printf(“PRESS 0 TO EXIT”);

textcolor(YELLOW);
gotoxy(1,1);

printf(“Enter train no:- “);

static char train_no[10];

int check;

fflush(stdin);

while(1)

{ scanf(“%s”,&train_no);

if(strcmp(train_no,”0”) == 0)

{ clrscr();

gotoxy(1,25);

textcolor(LIGHTRED);

printf(“\t\t\t\t\t\t\t\r”);

delay(200);

printf(“CANCELLING TRAIN PROCESS IS CANCELLED”);

textcolor(YELLOW);

return NULL;

check = check_train_no(train_no);

if(check == 0)

gotoxy(1,25);

textcolor(LIGHTRED);

printf(“\t\t\t\t\t\t\t\r”);

delay(200);
printf(“INVALID TRAIN NUMBER”);

gotoxy(17,1);

printf(“ \b\b\b\b\b”);

textcolor(YELLOW);

else

gotoxy(1,25);

printf(“\t\t\t\t\t”);

gotoxy(1,1);

return train_no;

int cancel_train(char *train_no)

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

FILE *fp = fopen(“d:\\myproject\\temp.dat”,”wb”);

if(fr == NULL)

printf(“NO BOOKINGS DONE YET”);

return -1;
}

if(fp == NULL)

printf(“TEMPORARY FILE CANNOT OPEN”);

return -1;

passenger psn;

int flag = 0;

while(fread(&psn,sizeof(passenger),1,fr))

if(strcmp(psn.train_no,train_no)!=0)

fwrite(&psn,sizeof(passenger),1,fp);

else

flag = 1;

fclose(fp);

fclose(fr);

if(flag == 0)

remove(“d:\\myproject\\temp.dat”);

else

remove(“d:\\myproject\\allbookings.dat”);
rename(“d:\\myproject\\temp.dat”,”f:\\myproject\\allbookings.dat”);

return flag;

char *accept_mob_no()

gotoxy(100,1);

textcolor(LIGHTGREEN);

printf(“PRESS 0 TO EXIT”);

gotoxy(1,1);

textcolor(YELLOW);

printf(“Enter Mobile no:-“);

while(1)

fflush(stdin);

static char mob_no[20];

fgets(mob_no,20,stdin);

char* pon;

pon=strchr(mob_no,’\n’);

if(pon!=NULL)

*pon=’\0’;

if(strcmp(mob_no,”0”) == 0)

{ clrscr();

gotoxy(1,25);

printf(“\t\t\t\t\t\t\t\r”);
textcolor(LIGHTRED);

delay(200);

printf(“INPUT CANCELLED”);

textcolor(YELLOW);

return NULL;

if(check_mob_no(mob_no)==0)

gotoxy(1,25);

textcolor(LIGHTRED);

delay(200);

printf(“ERROR ! MOBILE NUMBER SHOUD HAVE 10DIGITS AND SHOULD ONLY


BE DIGITS”);

textcolor(YELLOW);

gotoxy(18,1);

printf(“\t \b\b\b\b\b\b\b\b\b\b\b\b\b\b”);

else

gotoxy(1,25);

printf(“\t\t\t\t\t\t\t\t\t\t”);

gotoxy(1,1);

return mob_no;

}
int * get_ticket_no(char * mob_no)

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

if(fr == NULL)

return NULL;

int count = 0;

passenger psn;

while(fread(&psn,sizeof(passenger),1,fr))

if(strcmp(psn.mob_no,mob_no)==0)

count++;

if(count == 0)

fclose(fr);

return NULL;

int i = 0;

rewind(fr);

int *p = (int *)malloc((count+1)*sizeof(int));

while(fread(&psn,sizeof(passenger),1,fr))

{
if(strcmp(psn.mob_no,mob_no)==0)

*(p+i)=psn.ticket_no;

i++;

*(p+i)=-1;

fclose(fr);

return p;

void view_all_tickets(char *mob_no,int *ticket_no)

{ clrscr();

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

Train tr;

passenger psn;

if(fr == NULL)

printf(“NO TICKET BOOKED AGAINST THIS MOBILE NUMBER %s”,mob_no);

return;

if(ticket_no == NULL)

{ textcolor(LIGHTRED);

printf(“NO TICKET BOOKED AGAINST THIS MOBILE NUMBER %s”,mob_no);

return;
}

textcolor(WHITE);

printf(“FOLLOWING ARE THE TICKETS BOOK AGAINST THIS MOBILE NUMBER


%s”,mob_no);

int i = 0;

textcolor(LIGHTCYAN);

printf(“\n\nT.No\tClass\tName\t\tGender\tAge\tTrain No From\tTo\tFare\n”);

//textcolor(LIGHTMAGENTA);

int j;

for(j=0;j<120;j++)

textcolor((rand()%14)+1);

printf(“**”);

textcolor(YELLOW);

while(*(ticket_no + i)!=-1)

while(fread(&psn,sizeof(passenger),1,fr))

if(psn.ticket_no == *(ticket_no+i))

printf(“\n%d\t%c\t%s\t%c\t%d\t%s\t”,psn.ticket_no,psn.p_class,psn.p_name,psn.gender,psn.age,
psn.train_no);

while(fread(&tr,sizeof(Train),1,fp))

if(strcmp(psn.train_no,tr.train_no)==0)
{

if(psn.p_class == ‘S’)

printf(“ %s\t%s\t%d”,tr.from,tr.to,tr.sac_fare);

else

printf(“ %s\t%s\t%d”,tr.from,tr.to,tr.fac_fare);

rewind(fp);

break;

break;

i++;

printf(“\n\n”);

for(j=0;j<60;j++)

textcolor((rand()%14)+1);

printf(“**”);

fclose(fr);

fclose(fp);
}

void view_booking(char* train_no)

clrscr();

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

Train tr;

if(fr == NULL)

printf(“NO TICKET BOOKED AGAINST THIS TRAIN NUMBER %s”,train_no);

return;

passenger psn;

int flag = 0;

textcolor(WHITE);

printf(“FOLLOWING ARE THE TICKETS BOOK AGAINST THIS TRAIN NUMBER


%s”,train_no);

textcolor(LIGHTCYAN);

printf(“\n\nT.No\tClass\tName\t\tGender\tAge\tMobile No\tFrom\tTo\tFare Arr Dep\n”);

textcolor(LIGHTMAGENTA);

int i;

for(i=0;i<120;i++)

textcolor((rand()%14)+1);

printf(“**”);
}

textcolor(YELLOW);

while(fread(&psn,sizeof(passenger),1,fr))

if(strcmp(psn.train_no,train_no)==0)

flag = 1;

printf(“\n%d\t%c\t%s\t%c\t%d\t%s”,psn.ticket_no,psn.p_class,psn.p_name,psn.gender,psn.age,p
sn.mob_no);

while(fread(&tr,sizeof(Train),1,fp))

if(strcmp(psn.train_no,tr.train_no)==0)

if(psn.p_class == ‘S’)

printf(“\t%s\t%s\t%d %s %s”,tr.from,tr.to,tr.sac_fare,tr.arrival,tr.depart);

else

printf(“\t%s\t%s\t%d %s %s”,tr.from,tr.to,tr.fac_fare,tr.arrival,tr.depart);

rewind(fp);

break;

if(flag == 0)
{ clrscr();

textcolor(LIGHTRED);

delay(200);

printf(“NO TICKETS BOOKED IN TRAIN NUMBER %s FOUND”,train_no);

printf(“\n”);

for(i=0;i<60;i++)

textcolor((rand()%14)+1);

printf(“**”);

fclose(fr);

fclose(fp);

void view_all_bookings()

FILE *fr = fopen(“d:\\myproject\\allbookings.dat”,”rb”);

FILE *fp = fopen(“d:\\myproject\\alltrains.dat”,”rb”);

Train tr;

if(fr == NULL||fp==NULL)

{ textcolor(LIGHTRED);

printf(“NO BOOKINGS DONE YET”);

return;

textcolor(WHITE);
int flag = 0;

printf(“FOLOWING TICKETS ARE BOOKED”);

textcolor(LIGHTCYAN);

printf(“\n\nT.No Class Name Gender Age Mobile No Train no From To Fare Arr
Dep\n”);

textcolor(LIGHTMAGENTA);

int i;

for(i=0;i<120;i++)

textcolor((rand()%14)+1);

printf(“**”);

textcolor(YELLOW);

passenger psn;

while(fread(&psn,sizeof(passenger),1,fr))

printf(“\n%d\t%c %s %c %d %s %s
“,psn.ticket_no,psn.p_class,psn.p_name,psn.gender,psn.age,psn.mob_no,psn.train_no);

while(fread(&tr,sizeof(Train),1,fp))

if(strcmp(psn.train_no,tr.train_no)==0)

{ flag = 1;

if(psn.p_class == ‘S’)

printf(“ %s %s %d %s %s”,tr.from,tr.to,tr.sac_fare,tr.arrival,tr.depart);

else

printf(“ %s %s %d %s %s”,tr.from,tr.to,tr.fac_fare,tr.arrival,tr.depart);
rewind(fp);

break;

if(flag == 0)

clrscr();

textcolor(LIGHTRED);

delay(200);

printf(“NO BOOKINGS DONE YET”);

printf(“\n\n”);

textcolor(LIGHTMAGENTA);

for(i=0;i<60;i++)

textcolor((rand()%14)+1);

printf(“**”);

fclose(fr);

fclose(fp);

}
CHAPTER 6

TESTING

A level of software testing is a process where every unit or component of a


software or system is tested. The main goal of system testing is to evaluate the
system’s compliance with the specified needs.

There are many different testing levels which help to check behavior and
performance for software testing. There are mainly four testing levels:-

 Unit Testing:- A Unit is a smallest testable portion of system or application


which can be compiled, loaded, linked and executed. This kind of testing helps
to test each module separately.
The aim is to test each part of the software by separating it. It checks that
components are fulfilling functionalities or not. This kind of testing is
performed by developers.
 Integration Testing:- Integration means combining. In this testing phase,
different software modules are combined and tested as a group to make sure
that integrated system is ready for testing.

Integration Testing checks the data flow from one module to other modules.
This kind of testing is performed by testers.

 Acceptance Testing:- It is a test conducted to find if the requirements of a


specification or contract are met as per its delivery. Acceptance testing is
basically done by the user or customer. However, other stakeholders can be
involved in this process.
 System Testing:- System testing is performed on a complete integrated
system. System testing allows checking system’s compliance as per the
requirements. It tests the overall interaction of components. It involves load,
performance, reliability and security testing.

System testing is actually a series of different tasks whose primary purpose is


to fully exercise the computer-based system. Although each test has a different
purpose, all work to verify that system elements have been properly integrated
and perform allocated functions.
PICTORIAL REPRESENTATION OF LEVELS OF TESTING

1. Recovery Testing:- It is a system test that forces the software to fall in a


variety of ways and verifies that recovery is properly performed. If recovery
is automatic, re-initialization, check-pointing mechanisms, data recovery,
and restart are evaluated for correctness. If recovery requires human
intervention, the MTTR is evaluated to determine whether it is within
acceptable limits.
2. Security Testing:- It verifies that protection mechanisms built into the
system will, in fact, protect it from improper penetration.

During
security testing, the tester plays the role of the individual who desires to
penetrate the system. Anything goes!

 The tester may attack the system with custom software designed to
break down any defenses.
 The tester may overwhelm the system, thereby denying service to
others.
 The tester may purposely cause system errors, hoping to penetrate
during recovery.

Given enough time and resources, good security testing will ultimately
penetrate an insecure system.
3. Stress Testing:- It executes a system in a manner that demands resources in
abnormal, quantity, frequency, or volume. For example-
 Special tests may be designed that generate 10 interrupts per second,
when 1 or 2 is the average rate.
 Input data rates may be increased by an order of magnitude to
determine how input functions will respond.
 Test cases that require maximum memory or other resources are
executed.
 Test cases that may cause memory management problems are
designed.

Essentially, the tester attempts to overwhelm program.

4. Performance Testing:- It is designed to test the runtime performance of


software within the context of an integrated system. Performance testing
occurs throughout all steps, in the testing process. Even at the unit level, the
performance of an individual module may be assessed as test are conducted.
However, it is not until all system elements are fully integrated that the true
performance of a system can be ascertained.

Performance tests are


coupled with stress testing and usually require both hardware and software
instrumentation. That is, it is often necessary to measure resource utilization
in an exciting fashion.

 Debugging:- It is a consequence of successful testing. That is when a test


case uncovers an error, debugging is the process that results in the removal
of errors. There are mainly two types of debugging.
1. Backtracking:- It is a fairly common debugging approach that can be used
successfully in small programs. Beginning at the site where a symptom has
been uncovered, the source code is traced backward until the site of the
cause is found.
2. Brute Forcing:-This is the most common category of debugging which
involves loading the source code with write statements and tracking line by
line execution to isolate possible errors.
CHAPTER 7

CONCLUSION

Practical training is a very important part of the curriculum as it strengthens the concepts and
enhances knowledge about the practical implementation of all the theory concepts, we have
learnt so far in different subjects.

This project is used to keep track on reserving the seat to the passenger. It helps managing the
system very efficiently and conveniently. The aim of developing reservation system is to
provide all information that is required by the users. User friendliness is a must that is the user
must get the details without complicated searching procedures. Other important requirements of
the software are data security, extensibility and maintainability. All these features will be
included as updates to the application.

This project greatly helped in understanding the various phases in application development and
exposure to a new developer platform Code::Blocks.

Finally, this gives us a lot of mental satisfaction that the project we have worked upon will be
installed at the admin device after some more session of testing.

7.1 Limitations of this project:-


Although I have put my best efforts to make the software flexible, easy to operate but limitations
cannot be ruled out even by me. The software presents narrow range of options to its users and
some intricate options could not be covered into it; partly because of logistic and partly due to
lack of sophistication. Paucity of time was also major constraint, thus it was not possible to make
the software foolproof and dynamic.

The project has been done in a complete and detailed manner but due to constraint of time, we
could not include some more features we wanted to. We left these features as a part of the future
development. As soon as we’ll get time we’ll try to add them to our project.

Considerable efforts have made the software easy to operate even for the people not related to
the field of computers but it is acknowledged that a layman may find it a bit problematic at the
first instance. The user will be provided help at each step for his convenience in working with the
software.

 The transactions are executed in off-line mode, hence on-line data for Booking, passenger
capture and modification is not possible.
 The application does not provide the seats as per the desired quota since the quota option
is not included.
 The provision for waiting list or RAC seats is not there in the system. This system does
not handle these type of cases.
 Detailed route information is not provided for each train for e.g. if someone wants to
travel from Gwalior to GanjBasoda then for this case fair is not mentioned and the person
has to pay full fare from GWL to BPL because no train halts at destination GanjBasoda.
 It has no facility to check running status and schedule of the train.

7.2. Benefits :-

 If someone lost his/her confirmed ticket then he can re-issue his ticket from the counter.
The passenger has to tell the mobile number to admin.
 Admin is able to search record by using few clicks of mouse and few search keywords
thus saving his valuable time.

7.3 Future Work:-

 Quota option will be included in this application so that passenger can request their
confirmed ticket in the desired quota.
 Provision for waitlist ticket will be incorporated.
 Schedule (not running status) will be included in ticket booking option like Departure
Time from source and Arrival time at the destination.
References:-

1. Let us C by Yashwant Kanetkar, BPB Publications.


2. Software Engineering, A Practitioner’s Approach , Roger S. Pressman
McGraw Hill International Edition.
3. https://www.scribd.com/document/351142134/Java-JSP-And-MySQL-
Project-On-Railway-Reservation-System
4. https://www.tutorialspoint.com/cprogramming/c_file_io.htm
5. https://www.bmc.com/blogs/software-requirements-specification-how-to-
write-srs-with-examples/

You might also like