KENDRIYA VIDYALAYA
M.C.F LALGANJ RAEBARELI
A PROJECT REPORT ON
RAILWAY TICKET RESERVATION
COMPUTER SCIENCE(083)
SUBMITTED TO SUBMITTED BY:
MR. VIVEK GUPTA NITESH KUMAR
P.G.T.(COMP. SC)
CERTIFICATE
This is to certify that NITESH KUMAR of class XII-A of
KENDRIYA VIDYALAYA M.C.F LALGANJ RAEBARELI
has done his project on RAILWAY TICKET
RESERVATION under my supervision. He has taken
interest and has shown at most sincerity in completion of
this project.
I certify this Project up to my expectation & as per
guidelines issued by CBSE, NEW DELHI.
Internal Examiner External Examiner
Principal
ACKNOWLEDGMENT
It is with pleasure that I acknowledge my sincere gratitude
to our teacher, MR. VIVEK GUPTA who taught and
undertook the responsibility of teaching the subject
computer science. I have been greatly benefited from his
classes.
I am especially indebted to our Principal who has always
been a source of encouragement and support and without
whose inspiration this project would not have been a
successful I would like to place on record heartfelt thanks to
him.
Finally, I would like to express my sincere appreciation for
all the other students for my batch their friendship & the
fine times that we all shared together.
CODING
//Indian Railways ~ Ticket Reservation
//Submitted By NITESH KUMAR
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<process.h>
Char from[30],to[30];
Void detail()
Cout<<”From”<<end1;
Gets(to);
Cout<<”To”<<end1;
Gets(from);
class railways
Char station[30];
Unsigned int distance;
float fare;
public:
void ad_data()
Cout<<”Enter Railway Station name”<<end1;
Gets(station);
Cout<<”enter its distance from Jammu Tawi’<<end1;
Void amount(int a,int b,int c)
Cout<<”total distance=”<<fabs((a-b))*<<”\nticket cost
=”<<fare;
Unsigned int dist()
Return distance;
Char* station_v0()
Return station;
}
Void modify()
Cout<<”\nEnter new railway station\n”;
Gets(station);
Cout<<”\nenter its distance from jammu tawi\n”;
cin>>distance;
}tr;
Void main()
Clrscr();
Unsigned int per_km=5,choice, d1=0,d2=0,i;
Char station_searched[30];
While(1)
Clrscr();
Cout<<”\n\t\t\tWELCOME TO INDIAN RAILWAYS\n”;
For(i=0;i<80;i++)
{
Cout<<”-”;
Cout<<”Enter your choice \n\t 1:->Add new railway station\n\
t2:- >Book ticket”<<endl;
Cout<<”\t3:->Change per km rates\n\t4:->modify database of
train\n\t5:->exit\n”;
For(i=0;i<80;i++)
Cout<<”-“;
Cin>>choice;
While(choice==1)
Ofstream of 1 (“train.dat”,ios::binary | ios::app); tr.ad_data();
Of 1.write((char*)&tr,sizeof(tr)); of 1.close();
Break;
While(choice==2)
Ifstream of 1 (“train.dat”,ios::binary); detail0;
while(of 1)
of 1.read((char)&tr,sizeof(tr)); if(0==stricmp(from,tr.station_v())
d1=tr.dist();
If(0==stricmp(to,tr.station_v()))
d2=tr.dist();
if(d1 && d2)
Tr.amount(d1,d2,per_km);
getch();
break;
}
if (of 1.eof())
cout<<”\nstations not found check your spelling \n”;
getch();
of1.close();
break;
if (choice =3)
Cout<<”Enter new per km rates”;
Cin>>per_km;
If (choice==4)
Cout<<”enter the railway station to be changed”;
gets(station_searched);
Ifstream f1(“train.dat”,ios::binary);
While(f1)
fl.read((char*)&tr,sizeof(tr));
long pos=f1.tellg0;
if(0==strcmp(station_searched,tr.station_v()))
F1.seekg((-1 sizeof(tr),ios::cur));
tr.modify();
f1.close();
ofstream f1 (“train.dat”,ios::app);
f1.seekp(pos,ios::beg);
f1.write((char*)&tr,sizeof(tr));
cout<<”record modified”;
f1.close();
break;
else if(f1.eof())
cout<<”\nStation not found\n”;
getch();
}
if (choice==5)
cout<<”\nTHANK YOU FOR USING INDIAN RAILWAYS”;
getch();
exit(0);
if (choicel=1&&choice!=2&&choicel=3&&choice!=4&&choice!
=5)
Cout<<”entered wrong choice PROGRAM IS ABORTING!!!!!!”;
getch();
exit(0);
getch();
}
OUTPUT
PASTE YOUR OUTPUT HERE
BIBLIOGRAPHY
1. ANY BOOK NAME
2. GIVE NAME OF ANY WEB SITE OR REFERENCE
BOOK