Computer Science: Investigatory Project
Computer Science: Investigatory Project
Investigatory Project
On Railway Ticket
Reservation
DHANANJAY SOLANKI
12-A
ACKNOWLEDGEMENT
I would like to express a deep sense of
thanks and gratitude to my computer science
teacher Mr. VARUN ANAND for guiding me
immensely through the course of my
project. His constructive advice and
constant motivation have been responsible
for the successful completion of my project.
My sincere thanks to my parents for their
motivation and support. I must thank my
classmates for their timely help and support
for compilation of this project.
OBJECTIVE
WORKING
This program consists of FIVE options as
follows:
1. To add a new railway station
2. To book ticket
3. To change per km rates
4. To modify database of train
5. To exit
CODING
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<process.h>
void detail()
cout<<”From”<<endl;
gets(to);
cout<<”To”<<endl;
gets(from);
class railways
char station[60];
float fare;
public:
void ad_data()
cin>>distance;
fare=fabs((a-b))*c;
return distance;
char*station_v()
return station;
void modify()
gets(station);
} tr;
void main()
clrscr();
char station_searched[30];
while(1)
clrscr();
cout<<”~”;
cout<<”Enter your choice\n\t 1:~> Add new railway station \n\t2:~> Book
ticket”<<endl;
cout<<”~”;
}
cin>>choice;
while(choice==1)
tr.ad_data();
of1.write((char*)&tr, sizeof(tr));
of1.close();
break;
while(choice==2)
detail();
while(of1)
of1.read((char*)&tr, sizeof(tr));
if(0==strcmp(from, tr.station_v()))
d1=tr.dist();
If(0==strcmp(to, tr.station_v()))
{
d2= tr.dist();
If(d1&&d2)
getch();
break;
If(of1.eof())
getch();
of1.close();
break;
If(choice==3)
cin>>per_km;
if(choice==4)
{
gets(station_searched);
while(f1)
f1.read((char*)&tr, sizeof(tr));
long pos=f1.tellg();
if(0==strcmp(station_searched, tr.station_v()))
f1.seekg((~1*sizeof(tr), ios::cur));
tr.modify();
f1.close();
f1.seekp(pos, ios::beg);
f1.write((char*)&tr, sizeof(tr));
cout<<”record modified”;
f1.close();
break;
else if(f1.eof())
if(choice==5)
getch();
exit(0);
if(choice!=1&&choice!=2&&choice!=3&&choice!=4&&choice!=5)
getch();
exit(0);
getch();
}
BIBLIOGRAPHY
www.google.com
www.projects.icbse.com
www.scribd.com