SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
A Project Report
On
Railway TickeT ReseRvaTion
Submitted By
SANDEEP CHANDEL
Class : XII A
Under the Guidance
of
Mrs. Neeraj Yadav
PGT (Computer Science)
Department of Computer Science
Kendriya Vidyalaya A.A.I, Rangpuri
New Delhi.
Department of Computer Science
Kendriya Vidyalaya A.A.I, Rangpuri,
New Delhi
C E R T I F I C A T E
This is to certify that SANDEEP
CHANDEL
Of Class XII A has prepared the report on the Project entitled
“Railway Ticket Reservation”. The report is the result of his
efforts & endeavors. The report is found worthy of
acceptance
as final project report for the subject Computer Science of
Class
XII. He has prepared the report under my
guidance.
(Mrs. Neeraj Yadav)
PGT (Computer Science)
Department of Computer
Science Kendriya Vidyalaya
A.A.I, Rangpuri, New Delhi.
Department of Computer Science
Kendriya Vidyalaya A.A.I, Rangpuri,
New Delhi
c e R T i F i c a T e
The project report
entitled
“Railway Ticket Reservation”,
Submitted by SANDEEP CHANDEL of Class XII A for
the CBSE Senior Secondary Examination class XII of
Computer Science at Kendriya Vidyalaya A.A.I,
Rangpuri New Delhi has been examined.
SIGNATURE OF EXAMINER
D E C LA R A T I O N
I hereby declare that the project work entitled
“Railway Ticket Reservation”, submitted to
Department of Computer Science, KendriyaVidyalaya A.A.I
R
Rangpuri,
New Delhi is prepared by me. All thecoding are result of my personal efforts.
SANDEEP CHANDEL
Class XII A
A C K N O W L E D G E M E N T
I would like to express a deep sense of thanks & gratitude to my
project guide Mrs. Neeraj Yadav ma’am for guiding me immensely
through the course of the project. She always evinced keen interest in
my work. Her constructive advice & constant motivation have been
responsible for the successful completion of this project.
My sincere thanks goes to Shri P.P Yadav, Our principal sir, for his
co-ordination in extending every possible support for the completion of
this project.
I also thanks to my parents and sister for their motivation &
support. I must thanks to my classmates for their timely help & support
for compilation of this project.
Last but not the least, I would like to thank all those who had
helped directly or indirectly towards the completion of this project.
SANDEEP CHANDEL
Class: XII-
A
CONTENTS
1. HEADER FILES USED. . . . . . . . . . . . . . . . .
2. FILES GENERATED. . . . . . . . . . . . . . . . . . .
3. WORKING DESCRIPTION. . . . . . . . . . . . .
4. CODING. . . . . . . . . .. . . . . . . . . . . . . . . . .
5. OUTPUT SCREENS. . . . . . . . . . . . . . . . . . .
6. CONCLUSION. . . . . . . . . . . . . . . . . . . . . .
7. BIBLIOGRAPHY. . . . . . . . . . . . . . . . . . . . .
. . . .
HEADER FILES
USED
1. FSTREAM.H – for file handling, cin and cout
2. PROCESS.H – for exit() function
3. CONIO.H – for clrscr() and getch()
functions
4. STDIO.H – for standard I/O operations
5. STRING.H – for string handling
6. MATH.H–for doing mathematical operations
FILES
GENERATED
DATA FILES
TRAIN.DAT
PROGRAM FILE
RAILWAY TICKET RESERVATION.CPP
OBJECT
FILE
TRAIN.OBJ
EXECUTION FILE
TRAIN.EXE
WORKING DESCRIPTION
This program is designed to keep the friend’s
record.
This program consists of FIVE options
as follows
1. TO ADD NEW RAILWAY STATION
2. TO BOOK TICKET
3. TO CHANGE PER KM RATES
4. TO MODIFY DATABASE OF TRAIN
5. TO EXIT
CODING
//Indian Railways - Ticket Reservation
//Submitted By SANDEEP CHANDEL
#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"<<endl;
gets(to);
cout<<"To"<<endl
; gets(from);
}
class railways
{
char station[30];
unsigned int distance;
float fare;
public:
void ad_data()
{
cout<<"Enter Railway Station name"<<endl;
gets(station);
cout<<"enter its distance from Jammu Tawi"<<endl;
cin>>distance;
}
void amount(int a,int b,int c)
{
cout<<"total distance="<<fabs((a-b))<<"ncharges
per/km="<<c;
fare=fabs((a-b))*c;
cout<<"nticket cost ="<<fare;
}
unsigned int dist()
{
return distance;
}
char* station_v()
{
return station ;
}
void modify()
{
cout<<"nEnter new railway stationn";
gets(station);
cout<<"nenter its distance from jammu tawin";
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<<"ntttWELCOME TO INDIAN RAILWAYSn";
for(i=0;i<80;i++)
{
cout<<"-";
}
cout<<"Enter your choice nt1:->Add new railway stationnt2:-
>Book ticket"<<endl;
cout<<"t3:->Change per km ratesnt4:->modify database
of trainnt5:->exitn";
for(i=0;i<80;i++)
{
cout<<"-";
}
cin>>choice;
while(choice==1)
{
ofstream of1("train.dat",ios::binary|ios::app);
tr.ad_data();
of1.write((char*)&tr,sizeof(tr));
of1.close();
break;
}
while(choice==2)
{
ifstream of1("train.dat",ios::binary);
detail();
while(of1)
{ of1.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_k
m); getch();
break;
}
if(of1.eof())
{
cout<<"nstations not found check your spellingn";
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 )
{ 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();
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 foundn";
getch();
}
}
}
if(choice==5)
{
cout<<"nTHANK YOU FOR USING INDIAN RAILWAYS ";
getch();
exit(0);
}
if(choice!=1&&choice!=2&&choice!=3&&choice!=4&&choice!=5)
{
cout<<"entered wrong choice PROGRAM IS ABORTING!!!!!!";
getch();
exit(0);
}
}
getch();
}
OUTPUT
1. WELCOME SCREEN
2. ADD NEW RAILWAY STATION
3. TO BOOK TICKET
4. TO CHANGE PER KM RATES
5. TO MODIFY DATABASE OF TRAIN
6. TO EXIT
BIBLIOGRAPHY
1 http://www.google.com/
2 http://en.wikipedia.org
3 Computer Science with C++ by Sumita
Arora
4 Object Oriented Programming by
Robert
Lafore
5 www.bOtskOOL.com

Weitere ähnliche Inhalte

Was ist angesagt?

19701759 project-report-on-railway-reservation-system-by-amit-mittal
19701759 project-report-on-railway-reservation-system-by-amit-mittal19701759 project-report-on-railway-reservation-system-by-amit-mittal
19701759 project-report-on-railway-reservation-system-by-amit-mittal
satyaragha786
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murari
Sandip Murari
 
Bus Ticket Management System Documentation
Bus Ticket Management System DocumentationBus Ticket Management System Documentation
Bus Ticket Management System Documentation
muzammil siddiq
 
Database Management System of Travel Co.
Database Management System of Travel Co.Database Management System of Travel Co.
Database Management System of Travel Co.
Awais Ali
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdf
zccindia
 
FINAL PROJECT REPORT1
FINAL PROJECT REPORT1FINAL PROJECT REPORT1
FINAL PROJECT REPORT1
waqar younas
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
Sandip Murari
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeans
reshmajohney
 

Was ist angesagt? (20)

19701759 project-report-on-railway-reservation-system-by-amit-mittal
19701759 project-report-on-railway-reservation-system-by-amit-mittal19701759 project-report-on-railway-reservation-system-by-amit-mittal
19701759 project-report-on-railway-reservation-system-by-amit-mittal
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murari
 
Project Report Format College Project
 Project Report Format College Project Project Report Format College Project
Project Report Format College Project
 
Bus Ticket Management System Documentation
Bus Ticket Management System DocumentationBus Ticket Management System Documentation
Bus Ticket Management System Documentation
 
Report on online bus management
Report on online bus managementReport on online bus management
Report on online bus management
 
Database Management System of Travel Co.
Database Management System of Travel Co.Database Management System of Travel Co.
Database Management System of Travel Co.
 
quiz game project report.pdf
quiz game project report.pdfquiz game project report.pdf
quiz game project report.pdf
 
VTU final year project report
VTU final year project reportVTU final year project report
VTU final year project report
 
Project black book TYIT
Project black book TYITProject black book TYIT
Project black book TYIT
 
FINAL PROJECT REPORT1
FINAL PROJECT REPORT1FINAL PROJECT REPORT1
FINAL PROJECT REPORT1
 
Movie Rating Site [for presentation]
Movie Rating Site [for presentation]Movie Rating Site [for presentation]
Movie Rating Site [for presentation]
 
Virtual education system
Virtual education systemVirtual education system
Virtual education system
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
 
Students report card for C++ project..
Students report card for C++ project..Students report card for C++ project..
Students report card for C++ project..
 
Online Railway Reservation System
Online Railway Reservation SystemOnline Railway Reservation System
Online Railway Reservation System
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeans
 
Employee management system report
Employee management system reportEmployee management system report
Employee management system report
 
Unit converter using in c
Unit converter using in cUnit converter using in c
Unit converter using in c
 
Medical store management system
Medical store management systemMedical store management system
Medical store management system
 
computer science project class 12th
computer science project class 12thcomputer science project class 12th
computer science project class 12th
 

Ähnlich wie The railway ticket service c++ project class 12

Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12
Self-employed
 
DATA AND BUSINESS PROCESS INTELLIGENCE
DATA AND BUSINESS PROCESS INTELLIGENCEDATA AND BUSINESS PROCESS INTELLIGENCE
DATA AND BUSINESS PROCESS INTELLIGENCE
Swati Singh
 
Internship report on MyGP of Grameenphone LTD.
Internship report on MyGP of Grameenphone LTD.Internship report on MyGP of Grameenphone LTD.
Internship report on MyGP of Grameenphone LTD.
Insan Haque
 

Ähnlich wie The railway ticket service c++ project class 12 (20)

Computer project final for class 12 Students
Computer project final for class 12 StudentsComputer project final for class 12 Students
Computer project final for class 12 Students
 
Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12
 
Report Card making BY Mitul Patel
Report Card making BY Mitul PatelReport Card making BY Mitul Patel
Report Card making BY Mitul Patel
 
Computer science project
Computer science projectComputer science project
Computer science project
 
student-data-management-1-2.doc
student-data-management-1-2.docstudent-data-management-1-2.doc
student-data-management-1-2.doc
 
Student portal system application -Project Book
Student portal system application -Project BookStudent portal system application -Project Book
Student portal system application -Project Book
 
Integrated approach to sustainable development of indian railway stations t...
Integrated approach to sustainable development of indian railway stations   t...Integrated approach to sustainable development of indian railway stations   t...
Integrated approach to sustainable development of indian railway stations t...
 
Final Report
Final ReportFinal Report
Final Report
 
Summer internship report
Summer internship reportSummer internship report
Summer internship report
 
Dhananjay_Mishra
Dhananjay_MishraDhananjay_Mishra
Dhananjay_Mishra
 
DATA AND BUSINESS PROCESS INTELLIGENCE
DATA AND BUSINESS PROCESS INTELLIGENCEDATA AND BUSINESS PROCESS INTELLIGENCE
DATA AND BUSINESS PROCESS INTELLIGENCE
 
cv
cvcv
cv
 
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdfSTUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
 
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdfSTUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
STUDENT_INFORMATION_MANAGEMENT_SYSTEM.pdf
 
KUMARPAWAN (2)-1-1.pdf
KUMARPAWAN (2)-1-1.pdfKUMARPAWAN (2)-1-1.pdf
KUMARPAWAN (2)-1-1.pdf
 
325317356-Lpu-Final-Year-CSE-Project-Example.pdf
325317356-Lpu-Final-Year-CSE-Project-Example.pdf325317356-Lpu-Final-Year-CSE-Project-Example.pdf
325317356-Lpu-Final-Year-CSE-Project-Example.pdf
 
Internship report on MyGP of Grameenphone LTD.
Internship report on MyGP of Grameenphone LTD.Internship report on MyGP of Grameenphone LTD.
Internship report on MyGP of Grameenphone LTD.
 
211113 sushil-uupdated-resume
211113 sushil-uupdated-resume211113 sushil-uupdated-resume
211113 sushil-uupdated-resume
 
Application of industrial engineering techniques in garments production
Application of industrial engineering techniques      in garments productionApplication of industrial engineering techniques      in garments production
Application of industrial engineering techniques in garments production
 
Gearless Power Transmission Report
Gearless Power Transmission ReportGearless Power Transmission Report
Gearless Power Transmission Report
 

Kürzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

The railway ticket service c++ project class 12

  • 1. A Project Report On Railway TickeT ReseRvaTion Submitted By SANDEEP CHANDEL Class : XII A Under the Guidance of Mrs. Neeraj Yadav PGT (Computer Science) Department of Computer Science Kendriya Vidyalaya A.A.I, Rangpuri New Delhi.
  • 2. Department of Computer Science Kendriya Vidyalaya A.A.I, Rangpuri, New Delhi C E R T I F I C A T E This is to certify that SANDEEP CHANDEL Of Class XII A has prepared the report on the Project entitled “Railway Ticket Reservation”. The report is the result of his efforts & endeavors. The report is found worthy of acceptance as final project report for the subject Computer Science of Class XII. He has prepared the report under my guidance. (Mrs. Neeraj Yadav) PGT (Computer Science) Department of Computer Science Kendriya Vidyalaya A.A.I, Rangpuri, New Delhi.
  • 3. Department of Computer Science Kendriya Vidyalaya A.A.I, Rangpuri, New Delhi c e R T i F i c a T e The project report entitled “Railway Ticket Reservation”, Submitted by SANDEEP CHANDEL of Class XII A for the CBSE Senior Secondary Examination class XII of Computer Science at Kendriya Vidyalaya A.A.I, Rangpuri New Delhi has been examined. SIGNATURE OF EXAMINER
  • 4. D E C LA R A T I O N I hereby declare that the project work entitled “Railway Ticket Reservation”, submitted to Department of Computer Science, KendriyaVidyalaya A.A.I R Rangpuri, New Delhi is prepared by me. All thecoding are result of my personal efforts. SANDEEP CHANDEL Class XII A
  • 5. A C K N O W L E D G E M E N T I would like to express a deep sense of thanks & gratitude to my project guide Mrs. Neeraj Yadav ma’am for guiding me immensely through the course of the project. She always evinced keen interest in my work. Her constructive advice & constant motivation have been responsible for the successful completion of this project. My sincere thanks goes to Shri P.P Yadav, Our principal sir, for his co-ordination in extending every possible support for the completion of this project. I also thanks to my parents and sister for their motivation & support. I must thanks to my classmates for their timely help & support for compilation of this project. Last but not the least, I would like to thank all those who had helped directly or indirectly towards the completion of this project. SANDEEP CHANDEL Class: XII- A
  • 6. CONTENTS 1. HEADER FILES USED. . . . . . . . . . . . . . . . . 2. FILES GENERATED. . . . . . . . . . . . . . . . . . . 3. WORKING DESCRIPTION. . . . . . . . . . . . . 4. CODING. . . . . . . . . .. . . . . . . . . . . . . . . . . 5. OUTPUT SCREENS. . . . . . . . . . . . . . . . . . . 6. CONCLUSION. . . . . . . . . . . . . . . . . . . . . . 7. BIBLIOGRAPHY. . . . . . . . . . . . . . . . . . . . . . . . .
  • 7. HEADER FILES USED 1. FSTREAM.H – for file handling, cin and cout 2. PROCESS.H – for exit() function 3. CONIO.H – for clrscr() and getch() functions 4. STDIO.H – for standard I/O operations 5. STRING.H – for string handling 6. MATH.H–for doing mathematical operations
  • 8. FILES GENERATED DATA FILES TRAIN.DAT PROGRAM FILE RAILWAY TICKET RESERVATION.CPP OBJECT FILE TRAIN.OBJ EXECUTION FILE TRAIN.EXE
  • 9. WORKING DESCRIPTION This program is designed to keep the friend’s record. This program consists of FIVE options as follows 1. TO ADD NEW RAILWAY STATION 2. TO BOOK TICKET 3. TO CHANGE PER KM RATES 4. TO MODIFY DATABASE OF TRAIN 5. TO EXIT
  • 10. CODING //Indian Railways - Ticket Reservation //Submitted By SANDEEP CHANDEL #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"<<endl; gets(to); cout<<"To"<<endl ; gets(from); } class railways { char station[30]; unsigned int distance; float fare; public: void ad_data() { cout<<"Enter Railway Station name"<<endl; gets(station); cout<<"enter its distance from Jammu Tawi"<<endl; cin>>distance; } void amount(int a,int b,int c)
  • 11. { cout<<"total distance="<<fabs((a-b))<<"ncharges per/km="<<c; fare=fabs((a-b))*c; cout<<"nticket cost ="<<fare; } unsigned int dist() { return distance; } char* station_v() { return station ; } void modify() { cout<<"nEnter new railway stationn"; gets(station); cout<<"nenter its distance from jammu tawin"; 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<<"ntttWELCOME TO INDIAN RAILWAYSn"; for(i=0;i<80;i++) { cout<<"-";
  • 12. } cout<<"Enter your choice nt1:->Add new railway stationnt2:- >Book ticket"<<endl; cout<<"t3:->Change per km ratesnt4:->modify database of trainnt5:->exitn"; for(i=0;i<80;i++) { cout<<"-"; } cin>>choice; while(choice==1) { ofstream of1("train.dat",ios::binary|ios::app); tr.ad_data(); of1.write((char*)&tr,sizeof(tr)); of1.close(); break; } while(choice==2) { ifstream of1("train.dat",ios::binary); detail(); while(of1) { of1.read((char*)&tr,sizeof(tr)); if(0==stricmp(from,tr.station_v()) ) { d1=tr.dist(); }
  • 13. if(0==stricmp(to,tr.station_v())) { d2=tr.dist(); } if(d1 && d2) { tr.amount(d1,d2,per_k m); getch(); break; } if(of1.eof()) { cout<<"nstations not found check your spellingn"; 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 )
  • 14. { 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(); 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 foundn"; getch();
  • 15. } } } if(choice==5) { cout<<"nTHANK YOU FOR USING INDIAN RAILWAYS "; getch(); exit(0); } if(choice!=1&&choice!=2&&choice!=3&&choice!=4&&choice!=5) { cout<<"entered wrong choice PROGRAM IS ABORTING!!!!!!"; getch(); exit(0); } } getch(); }
  • 16. OUTPUT 1. WELCOME SCREEN 2. ADD NEW RAILWAY STATION
  • 17. 3. TO BOOK TICKET 4. TO CHANGE PER KM RATES
  • 18. 5. TO MODIFY DATABASE OF TRAIN
  • 20. BIBLIOGRAPHY 1 http://www.google.com/ 2 http://en.wikipedia.org 3 Computer Science with C++ by Sumita Arora 4 Object Oriented Programming by Robert Lafore 5 www.bOtskOOL.com