SlideShare a Scribd company logo
1 of 31
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<time.h>
#include<iomanip.h>
#include<fstream.h>
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;
void getid()
{
cout<<"Enter your id:";gets(id);
cout<<"nEnter the password:";
gets(password);
strcpy(pass,password);
}
void displayid()
{
cout<<"Id:";puts(id);
cout<<"Password:";puts(pass);
}
};
class detail
{
public:
int tno;
char tname[100];
char bp[100];
char dest[100];
int c1,c1fare;
int c2,c2fare;
int d,m,y;
void getdetail()
{
cout<<"Enter the details as followsn";
cout<<"Train no:";cin>>tno;
cout<<"Train name:";gets(tname);
cout<<"Boarding point:";gets(bp);
cout<<"Destination pt:";gets(dest);
cout<<"No of seats in first class & fareper ticket:";
cin>>c1>>c1fare;
cout<<"No of seats in second class & fareper ticket:";
cin>>c2>>c2fare;
cout<<"Date of travel:";cin>>d>>m>>y;
}
void displaydetail()
{
cout<<tno<<"t"<<tname<<"t"<<bp<<"t"<<dest<<"t";
cout<<c1<<"t"<<c1fare<<"t"<<c2<<"t"<<c2fare<<"t";
cout<<d<<"-"<<m<<"-"<<y<<"t"<<endl;
}
};
class reser
{
public:
int pnr;
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();
void displayresdet();
};
void reser::getresdet()
{
cout<<"Enter the details as followsn";
cout<<"Train no:";cin>>tno;
cout<<"Train name:";gets(tname);
cout<<"Boarding point:";gets(bp);
cout<<"Destination pt:";gets(dest);
cout<<"No of seats required:";cin>>nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name:";gets(pname[i]);
cout<<"Passenger age:";cin>>age[i];
}
cout<<"Enter the class f-firstclass s-second class:";
gets(clas);
cout<<"Date of travel:";cin>>d>>m>>y;
cout<<"Enter the concession categoryn";
cout<<"1.Militaryn2.Senior citizenn";
cout<<"3.Children below 5 yrsn4.Nonen";
cin>>con;
cout<<"............END OF GETTING DETAILS............n";
}
void reser::displayresdet()
{
cout<<"...............................................n";
cout<<"...............................................n";
cout<<"Pnr no:"<<pnr;
cout<<"nTrain no:"<<tno;
cout<<"nTrain name:";puts(tname);
cout<<"Boarding point:";puts(bp);
cout<<"Destination pt:";puts(dest);
cout<<"No of seats reserved:"<<nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name:";puts(pname[i]);
cout<<"Passenger age:"<<age[i];
}
cout<<"nYour class:";puts(clas);
cout<<"nDate of reservation:"<<d<<"-"<<m<<"-"<<y;
cout<<"nYour concession category:"<<con;
cout<<"nYou mustpay:"<<amc<<endl;
cout<<"***********************************************n";
cout<<".........END OF RESERVATION.................n";
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()
{
cout<<"Enter the details as followsn";
cout<<"Pnr no:";cin>>pnr;
cout<<"Date of cancellation:";cin>>d>>m>>y;
cout<<"...........END OF GETTING DETAILS...........n";
}
void displaycancdet() ;
};
void canc::displaycancdet()
{
cout<<"...........................................n";
cout<<"...........................................n";
cout<<"Pnr no:"<<pnr;
cout<<"nTrain no:"<<tno;
cout<<"nTrain name:";puts(tname);
cout<<"Boarding point:";puts(bp);
cout<<"Destination pt:";puts(dest);
cout<<"nYour class:";puts(clas);
cout<<"no of seats to be cancelled:"<<nosc;
for(i=0;i<nosc;i++)
{
cout<<"Passenger name:";puts(pname[i]);
cout<<"passenger age:"<<age[i];
}
cout<<"nDate of cancellation:"<<d<<"-"<<m<<"-"<<y;
cout<<"nYou can collect:"<<amr<<"rs"<<endl;
cout<<"*****************************************n";
cout<<".........END OF CANCELLATION.............n";
cout<<"*****************************************n";
}
void manage();
void can();
void user();
void database();
void res();
void reserve();
void displaypassdetail();
void cancell();
void enquiry();
void main()
{
clrscr();
int ch;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n";
cout<<".......WELCOMETO RAILWAYRESERVATIONSYSTEM..........n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n";
do
{
cout<<"^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^n";
cout<<"1.Admin moden2.User moden3.Exitn";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
database();
break;
case 2:
user();
break;
case 3:
exit(0);
}
}while(ch<=3);
getch();
}
void database()
{
char *password;
char *pass="12345678";
cout<< "Enter the admininistrator password:";
gets(password);
detail a;
fstreamf;
int ch;
char c;
if(strcmp(pass,password)!=0)
{
cout<<"Enter the password correctly n";
cout<<"You are not permitted to logon this moden";
goto h;
}
if(strcmp(pass,password)==0)
{
char c;
do
{
cout<<"...........ADMINISTRATORMENU...........n";
cout<<"1.Create detail data basen2.Add detailsn";
cout<<"3.Display detailsn4.User managementn";
cout<<"5.Display passenger detailsn6.Return to main menun";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
f.open("t.txt",ios::out|ios::binary);
do
{
a.getdetail();
f.write((char *) & a,sizeof(a));
cout<<"Do you wantto add one morerecord?n";
cout<<"y-for Yesnn-for Non";
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;
case 3:
f.open("t.txt",ios::in|ios::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);
f.close();
}
h:
}
void reserve()
{
int ch;
do
{
cout<<"1.Reserven2.Return to the main menun";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
res();
break;
}
}while(ch==1);
getch();
}
void res()
{
detail a;
reser b;
fstreamf1,f2;
time_t t;
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary|ios::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.c1fare;
addr=f1.tellg();
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
a.c1=a.c1-b.nosr;
f1.write((char *) & a.c1,sizeof(a.c1));
if(b.con==1)
{
cout<<"Concession category:MILITARYPERSONNELn";
b.amc=b.nosr*((amt*50)/100);
}
else if(b.con==2)
{
cout<<"Concession category:SENIORCITIZENn";
b.amc=b.nosr*((amt*60)/100);
}
else if(b.con==3)
{
cout<<"Concession category:CHILDERNBELOW FIVEn";
b.amc=0.0;
}
else if(b.con==4)
{
cout<<"You cannot get any concessionn";
b.amc=b.nosr*amt;
}
srand((unsigned) time(&t));
b.pnr=rand();
f2.write((char *) & b,sizeof(b));
b.displayresdet();
cout<<"------------------------------------------------------n";
cout<<"--------------Yourticketis reserved-----------n";
cout<<"-----------------End of reservation menu-------n";
}
else
{
cout<<"**********Sorry req seats not available********n";
}
}
else if(strcmp(b.clas,s)==0)
{
if(a.c2>=b.nosr)
{
amt=a.c2fare;
addr=f1.tellg();
ad=sizeof(a.c2);
f1.seekp(addr-(5*ad));
a.c2=a.c2-b.nosr;
f1.write((char *) & a.c2,sizeof(a.c2));
if(b.con==1)
{
cout<<"Concession category:MILITARYPRESONNELn";
b.amc=b.nosr*((amt*50)/100);
}
else if(b.con==2)
{
cout<<"Concession category:SENIORCITIZENn";
b.amc=b.nosr*((amt*60)/100);
}
else if(b.con==3)
{
cout<<"Concession category:CHILDERNBELOW FIVEn";
b.amc=0.0;
}
else if(b.con==4)
{
cout<<"You cannot get any concessionn";
b.amc=b.nosr*amt;
}
f2.write((char *) & b,sizeof(b));
b.displayresdet();
cout<<"---------------------------------------n";
cout<<"--------Your ticketis reserved--------n";
cout<<"------------End of reservation---------n";
}
else
{
cout<<"********Sorry req no of seats not available*******n";
}
}
getch();
goto h;
}
else
{
flag=0;
}
}
if(flag==0)
{
cout<<"............Wrong train no......................n";
cout<<"......Enter the train no from the data base.....n";
}
f1.close();
f2.close();
getch();
h:
}
void displaypassdetail()
{
fstreamf;
reser b;
f.open("p.txt",ios::in|ios::out|ios::binary);
f.seekg(0);
while(f.read((char *) & b,sizeof(b)))
{
b.displayresdet();
}
f.close();
getch();
}
void enquiry()
{
fstreamf;
f.open("t.txt",ios::in|ios::out|ios::binary);
detail a;
while(f.read((char *) & a,sizeof(a)))
{
a.displaydetail();
}
getch();
}
void cancell()
{
detail a;
reser b;
canc c;
fstreamf1,f2,f3;
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary);
f3.open("cn.txt",ios::in|ios::out|ios::binary);
cout<<"**********CANCELLATION MENU*********n";
c.getcancdet();
while(f2.read((char *) & b,sizeof(b)))
{
if(b.pnr==c.pnr)
{
c.tno=b.tno;
strcpy(c.tname,b.tname);
strcpy(c.bp,b.bp);
strcpy(c.dest,b.dest);
c.nosc=b.nosr;
for(intj=0;j<c.nosc;j++)
{
strcpy(c.pname[j],b.pname[j]);
c.age[j]=b.age[j];
}
strcpy(c.clas,b.clas);
if(strcmp(c.clas,f)==0)
{
while(f1.read((char *) & a,sizeof(a)))
{
if(a.tno==c.tno)
{
a.c1=a.c1+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
f1.write((char *) & a.c1,sizeof(a.c1));
tamt=b.amc;
if((c.d==d)&&(c.m==m))
{
cout<<"You are cancelling at the date of departuren";
c.amr=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are cancelling at the month of departuren";
c.amr=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are cancelling one month before the date of departuren";
c.amr=tamt-((tamt*20)/100);
}
else
{
cout<<"Cancelling after the departuren";
cout<<"Your request cannot be completedn";
}
goto h;
c.displaycancdet();
}
}
}
else if(strcmp(c.clas,s)==0)
{
while(f1.read((char *) & a,sizeof(a)))
{
if(a.tno==c.tno)
{
a.c2=a.c2+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c2);
f1.seekp(addr-(5*ad));
f1.write((char *) & a.c2,sizeof(a.c2));
tamt=b.amc;
if((c.d==d)&&(c.m==m))
{
cout<<"You are cancelling at the date of departuren";
c.amr=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are cancelling at the month of departuren";
c.amr=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are cancelling one month before the date of departuren";
c.amr=tamt-((tamt*20)/100);
}
else
{
cout<<"Cancelling after the departuren";
cout<<"Your request cannot be completedn";
}
goto h;
c.displaycancdet();
}
}
}
}
else
{
flag=0;
}
}
h:
if(flag==0)
{
cout<<"Enter the correctpnr non";
}
f1.close();
f2.close();
f3.close();
getch();
}
void can()
{
int ch;
do
{
cout<<".................CANCELLATIONMENU.........n";
cout<<"1.Cancelln2.Return to the main menun";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
cancell();
break;
}
}while(ch==1);
getch();
}
void user()
{
login a;
int ch;
cout<<"*****************************************************n";
cout<<"***********WELCOME TO THE USER MENU**n";
cout<<"****************************************************n";
char *password;
fstreamf;
f.open("id.txt",ios::in|ios::out|ios::binary);
char id[100];
puts("Enter your id:");gets(id);
puts("Enter your password:");gets(password);
while(f.read((char *) & a,sizeof(a)))
{
if((strcmp(a.id,id)==0)&&(strcmp(a.pass,password)==0))
{
do
{
cout<<"1.Reserven2.Cancelln3.Enquiryn4.Return to the main menun";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
reserve();
break;
case 2:
cancell();
break;
case 3:
enquiry();
break;
}
}while(ch<=3);
goto j;
}
else
{
d=1;
}
}
if(d==1)
{
cout<<"Enter your user id and password correctlyn";
}
getch();
j:
}
void manage()
{
int ch;
fstreamf;
char c;
login a;
cout<<".........WELCOMETO THEUSER MANAGEMENT MENU........n";
do
{
cout<<"1.Create id data basen2.Add detailsn";
cout<<"3.Display detailsn4.Return to the main menun";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
f.open("id.txt",ios::out|ios::binary);
do
{
a.getid();
f.write((char *) & a,sizeof(a));
cout<<"Do you wantto add one morerecordn";
cout<<"y-Yesnn-Non";
cin>>c;
}while(c=='y');
f.close();
break;
case 2:
f.open("id.txt",ios::in|ios::out|ios::binary|ios::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);
getch();
}

More Related Content

What's hot (20)

The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
 
Python 炒股指南
Python 炒股指南 Python 炒股指南
Python 炒股指南
 
Cpp c++ 1
Cpp c++ 1Cpp c++ 1
Cpp c++ 1
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
C++ programs
C++ programsC++ programs
C++ programs
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
5th Sem SS lab progs
5th Sem SS lab progs5th Sem SS lab progs
5th Sem SS lab progs
 
Ae internals
Ae internalsAe internals
Ae internals
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
Pop3ck sh
Pop3ck shPop3ck sh
Pop3ck sh
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Tajmahal
TajmahalTajmahal
Tajmahal
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trial
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
Advanced modulinos
Advanced modulinosAdvanced modulinos
Advanced modulinos
 
distill
distilldistill
distill
 
Hsn code not show
Hsn code not showHsn code not show
Hsn code not show
 
ClojurianからみたElixir
ClojurianからみたElixirClojurianからみたElixir
ClojurianからみたElixir
 
C++ L05-Functions
C++ L05-FunctionsC++ L05-Functions
C++ L05-Functions
 

Similar to RAILWAY RESERWATION PROJECT PROGRAM

Railway reservation
Railway reservationRailway reservation
Railway reservationSwarup Boro
 
C basics
C basicsC basics
C basicsMSc CST
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st StudyChris Ohk
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++ Arun Nair
 
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfadisainternational
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfHIMANSUKUMAR12
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphicsVtech Academy of Computers
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semesterDOSONKA Group
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacionJeff Tu Pechito
 
C programming function
C  programming functionC  programming function
C programming functionargusacademy
 
Computer science project work
Computer science project workComputer science project work
Computer science project workrahulchamp2345
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207Syed Tanveer
 
Double linked list
Double linked listDouble linked list
Double linked listSayantan Sur
 

Similar to RAILWAY RESERWATION PROJECT PROGRAM (20)

Railway reservation
Railway reservationRailway reservation
Railway reservation
 
Tu1
Tu1Tu1
Tu1
 
C basics
C basicsC basics
C basics
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 
C programms
C programmsC programms
C programms
 
include ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdfinclude ltstdiohgt include ltstringhgt define M.pdf
include ltstdiohgt include ltstringhgt define M.pdf
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphics
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semester
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 
C programming function
C  programming functionC  programming function
C programming function
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
Double linked list
Double linked listDouble linked list
Double linked list
 
Hospital management
Hospital managementHospital management
Hospital management
 
Hospital management
Hospital managementHospital management
Hospital management
 

More from Krishna Raj

Light emitting diode(LED)
Light emitting diode(LED)Light emitting diode(LED)
Light emitting diode(LED)Krishna Raj
 
How to energize and use ice breakers
How to energize and use ice breakersHow to energize and use ice breakers
How to energize and use ice breakersKrishna Raj
 
Magnetic levitation(kr)
Magnetic levitation(kr)Magnetic levitation(kr)
Magnetic levitation(kr)Krishna Raj
 
MAGNETISM,EARTH MAGNETIC FIELD
MAGNETISM,EARTH MAGNETIC FIELDMAGNETISM,EARTH MAGNETIC FIELD
MAGNETISM,EARTH MAGNETIC FIELDKrishna Raj
 
Technical inovation in mechanical field
Technical inovation in mechanical fieldTechnical inovation in mechanical field
Technical inovation in mechanical fieldKrishna Raj
 
Technological disaster
Technological disaster Technological disaster
Technological disaster Krishna Raj
 
Newton's laws of motion (krishnaraj)
Newton's laws of motion (krishnaraj)Newton's laws of motion (krishnaraj)
Newton's laws of motion (krishnaraj)Krishna Raj
 
RAILWAY RESERWATION PROJECT
RAILWAY RESERWATION PROJECTRAILWAY RESERWATION PROJECT
RAILWAY RESERWATION PROJECTKrishna Raj
 
Diversityinlivingorganisms for class 9 by kr
Diversityinlivingorganisms for class 9 by krDiversityinlivingorganisms for class 9 by kr
Diversityinlivingorganisms for class 9 by krKrishna Raj
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRKrishna Raj
 
Indian nobel prize winners
Indian nobel prize winnersIndian nobel prize winners
Indian nobel prize winnersKrishna Raj
 
Information technology
Information technologyInformation technology
Information technologyKrishna Raj
 
Introduction to trignometry
Introduction to trignometryIntroduction to trignometry
Introduction to trignometryKrishna Raj
 

More from Krishna Raj (14)

Light emitting diode(LED)
Light emitting diode(LED)Light emitting diode(LED)
Light emitting diode(LED)
 
How to energize and use ice breakers
How to energize and use ice breakersHow to energize and use ice breakers
How to energize and use ice breakers
 
Magnetic levitation(kr)
Magnetic levitation(kr)Magnetic levitation(kr)
Magnetic levitation(kr)
 
MAGNETISM,EARTH MAGNETIC FIELD
MAGNETISM,EARTH MAGNETIC FIELDMAGNETISM,EARTH MAGNETIC FIELD
MAGNETISM,EARTH MAGNETIC FIELD
 
Technical inovation in mechanical field
Technical inovation in mechanical fieldTechnical inovation in mechanical field
Technical inovation in mechanical field
 
Technological disaster
Technological disaster Technological disaster
Technological disaster
 
Newton's laws of motion (krishnaraj)
Newton's laws of motion (krishnaraj)Newton's laws of motion (krishnaraj)
Newton's laws of motion (krishnaraj)
 
RAILWAY RESERWATION PROJECT
RAILWAY RESERWATION PROJECTRAILWAY RESERWATION PROJECT
RAILWAY RESERWATION PROJECT
 
Diversityinlivingorganisms for class 9 by kr
Diversityinlivingorganisms for class 9 by krDiversityinlivingorganisms for class 9 by kr
Diversityinlivingorganisms for class 9 by kr
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
Indian nobel prize winners
Indian nobel prize winnersIndian nobel prize winners
Indian nobel prize winners
 
Information technology
Information technologyInformation technology
Information technology
 
Transport
TransportTransport
Transport
 
Introduction to trignometry
Introduction to trignometryIntroduction to trignometry
Introduction to trignometry
 

Recently uploaded

Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

RAILWAY RESERWATION PROJECT PROGRAM

  • 1. PROGRAM #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> #include<iostream.h> #include<time.h> #include<iomanip.h> #include<fstream.h> 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; void getid() { cout<<"Enter your id:";gets(id);
  • 2. cout<<"nEnter the password:"; gets(password); strcpy(pass,password); } void displayid() { cout<<"Id:";puts(id); cout<<"Password:";puts(pass); } }; class detail { public: int tno; char tname[100]; char bp[100]; char dest[100]; int c1,c1fare; int c2,c2fare; int d,m,y; void getdetail() {
  • 3. cout<<"Enter the details as followsn"; cout<<"Train no:";cin>>tno; cout<<"Train name:";gets(tname); cout<<"Boarding point:";gets(bp); cout<<"Destination pt:";gets(dest); cout<<"No of seats in first class & fareper ticket:"; cin>>c1>>c1fare; cout<<"No of seats in second class & fareper ticket:"; cin>>c2>>c2fare; cout<<"Date of travel:";cin>>d>>m>>y; } void displaydetail() { cout<<tno<<"t"<<tname<<"t"<<bp<<"t"<<dest<<"t"; cout<<c1<<"t"<<c1fare<<"t"<<c2<<"t"<<c2fare<<"t"; cout<<d<<"-"<<m<<"-"<<y<<"t"<<endl; } }; class reser { public: int pnr; int tno;
  • 4. 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(); void displayresdet(); }; void reser::getresdet() { cout<<"Enter the details as followsn"; cout<<"Train no:";cin>>tno; cout<<"Train name:";gets(tname); cout<<"Boarding point:";gets(bp); cout<<"Destination pt:";gets(dest);
  • 5. cout<<"No of seats required:";cin>>nosr; for(i=0;i<nosr;i++) { cout<<"Passenger name:";gets(pname[i]); cout<<"Passenger age:";cin>>age[i]; } cout<<"Enter the class f-firstclass s-second class:"; gets(clas); cout<<"Date of travel:";cin>>d>>m>>y; cout<<"Enter the concession categoryn"; cout<<"1.Militaryn2.Senior citizenn"; cout<<"3.Children below 5 yrsn4.Nonen"; cin>>con; cout<<"............END OF GETTING DETAILS............n"; } void reser::displayresdet() { cout<<"...............................................n"; cout<<"...............................................n"; cout<<"Pnr no:"<<pnr; cout<<"nTrain no:"<<tno; cout<<"nTrain name:";puts(tname); cout<<"Boarding point:";puts(bp);
  • 6. cout<<"Destination pt:";puts(dest); cout<<"No of seats reserved:"<<nosr; for(i=0;i<nosr;i++) { cout<<"Passenger name:";puts(pname[i]); cout<<"Passenger age:"<<age[i]; } cout<<"nYour class:";puts(clas); cout<<"nDate of reservation:"<<d<<"-"<<m<<"-"<<y; cout<<"nYour concession category:"<<con; cout<<"nYou mustpay:"<<amc<<endl; cout<<"***********************************************n"; cout<<".........END OF RESERVATION.................n"; cout<<"***********************************************n"; } class canc { public: int pnr; int tno; char tname[100];
  • 7. 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() { cout<<"Enter the details as followsn"; cout<<"Pnr no:";cin>>pnr; cout<<"Date of cancellation:";cin>>d>>m>>y; cout<<"...........END OF GETTING DETAILS...........n"; } void displaycancdet() ; }; void canc::displaycancdet() { cout<<"...........................................n"; cout<<"...........................................n"; cout<<"Pnr no:"<<pnr;
  • 8. cout<<"nTrain no:"<<tno; cout<<"nTrain name:";puts(tname); cout<<"Boarding point:";puts(bp); cout<<"Destination pt:";puts(dest); cout<<"nYour class:";puts(clas); cout<<"no of seats to be cancelled:"<<nosc; for(i=0;i<nosc;i++) { cout<<"Passenger name:";puts(pname[i]); cout<<"passenger age:"<<age[i]; } cout<<"nDate of cancellation:"<<d<<"-"<<m<<"-"<<y; cout<<"nYou can collect:"<<amr<<"rs"<<endl; cout<<"*****************************************n"; cout<<".........END OF CANCELLATION.............n"; cout<<"*****************************************n"; } void manage(); void can(); void user(); void database();
  • 9. void res(); void reserve(); void displaypassdetail(); void cancell(); void enquiry(); void main() { clrscr(); int ch; cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n"; cout<<".......WELCOMETO RAILWAYRESERVATIONSYSTEM..........n"; cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n"; do { cout<<"^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^n"; cout<<"1.Admin moden2.User moden3.Exitn"; cout<<"Enter your choice:"; cin>>ch; cout<<endl; switch(ch) { case 1:
  • 10. database(); break; case 2: user(); break; case 3: exit(0); } }while(ch<=3); getch(); } void database() { char *password; char *pass="12345678"; cout<< "Enter the admininistrator password:"; gets(password); detail a; fstreamf; int ch; char c; if(strcmp(pass,password)!=0) {
  • 11. cout<<"Enter the password correctly n"; cout<<"You are not permitted to logon this moden"; goto h; } if(strcmp(pass,password)==0) { char c; do { cout<<"...........ADMINISTRATORMENU...........n"; cout<<"1.Create detail data basen2.Add detailsn"; cout<<"3.Display detailsn4.User managementn"; cout<<"5.Display passenger detailsn6.Return to main menun"; cout<<"Enter your choice:"; cin>>ch; cout<<endl; switch(ch) { case 1: f.open("t.txt",ios::out|ios::binary); do
  • 12. { a.getdetail(); f.write((char *) & a,sizeof(a)); cout<<"Do you wantto add one morerecord?n"; cout<<"y-for Yesnn-for Non"; 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; case 3: f.open("t.txt",ios::in|ios::out|ios::binary|ios::app); f.seekg(0); while(f.read((char *) & a,sizeof(a))) { a.displaydetail(); } f.close();
  • 13. break; case 4: manage(); break; case 5: displaypassdetail(); break; } }while(ch<=5); f.close(); } h: } void reserve() { int ch; do { cout<<"1.Reserven2.Return to the main menun"; cout<<"Enter your choice:"; cin>>ch; cout<<endl;
  • 14. switch(ch) { case 1: res(); break; } }while(ch==1); getch(); } void res() { detail a; reser b; fstreamf1,f2; time_t t; f1.open("t.txt",ios::in|ios::out|ios::binary); f2.open("p.txt",ios::in|ios::out|ios::binary|ios::app); int ch; b.getresdet(); while(f1.read((char *) &a,sizeof(a))) { if(a.tno==b.tno) {
  • 15. if(strcmp(b.clas,f)==0) { if(a.c1>=b.nosr) { amt=a.c1fare; addr=f1.tellg(); ad=sizeof(a.c1); f1.seekp(addr-(7*ad)); a.c1=a.c1-b.nosr; f1.write((char *) & a.c1,sizeof(a.c1)); if(b.con==1) { cout<<"Concession category:MILITARYPERSONNELn"; b.amc=b.nosr*((amt*50)/100); } else if(b.con==2) { cout<<"Concession category:SENIORCITIZENn"; b.amc=b.nosr*((amt*60)/100); } else if(b.con==3)
  • 16. { cout<<"Concession category:CHILDERNBELOW FIVEn"; b.amc=0.0; } else if(b.con==4) { cout<<"You cannot get any concessionn"; b.amc=b.nosr*amt; } srand((unsigned) time(&t)); b.pnr=rand(); f2.write((char *) & b,sizeof(b)); b.displayresdet(); cout<<"------------------------------------------------------n"; cout<<"--------------Yourticketis reserved-----------n"; cout<<"-----------------End of reservation menu-------n"; } else { cout<<"**********Sorry req seats not available********n"; } }
  • 17. else if(strcmp(b.clas,s)==0) { if(a.c2>=b.nosr) { amt=a.c2fare; addr=f1.tellg(); ad=sizeof(a.c2); f1.seekp(addr-(5*ad)); a.c2=a.c2-b.nosr; f1.write((char *) & a.c2,sizeof(a.c2)); if(b.con==1) { cout<<"Concession category:MILITARYPRESONNELn"; b.amc=b.nosr*((amt*50)/100); } else if(b.con==2) { cout<<"Concession category:SENIORCITIZENn"; b.amc=b.nosr*((amt*60)/100); } else if(b.con==3) { cout<<"Concession category:CHILDERNBELOW FIVEn";
  • 18. b.amc=0.0; } else if(b.con==4) { cout<<"You cannot get any concessionn"; b.amc=b.nosr*amt; } f2.write((char *) & b,sizeof(b)); b.displayresdet(); cout<<"---------------------------------------n"; cout<<"--------Your ticketis reserved--------n"; cout<<"------------End of reservation---------n"; } else { cout<<"********Sorry req no of seats not available*******n"; } } getch(); goto h;
  • 19. } else { flag=0; } } if(flag==0) { cout<<"............Wrong train no......................n"; cout<<"......Enter the train no from the data base.....n"; } f1.close(); f2.close(); getch(); h: } void displaypassdetail() { fstreamf; reser b; f.open("p.txt",ios::in|ios::out|ios::binary); f.seekg(0); while(f.read((char *) & b,sizeof(b)))
  • 20. { b.displayresdet(); } f.close(); getch(); } void enquiry() { fstreamf; f.open("t.txt",ios::in|ios::out|ios::binary); detail a; while(f.read((char *) & a,sizeof(a))) { a.displaydetail(); } getch(); } void cancell() { detail a; reser b; canc c;
  • 21. fstreamf1,f2,f3; f1.open("t.txt",ios::in|ios::out|ios::binary); f2.open("p.txt",ios::in|ios::out|ios::binary); f3.open("cn.txt",ios::in|ios::out|ios::binary); cout<<"**********CANCELLATION MENU*********n"; c.getcancdet(); while(f2.read((char *) & b,sizeof(b))) { if(b.pnr==c.pnr) { c.tno=b.tno; strcpy(c.tname,b.tname); strcpy(c.bp,b.bp); strcpy(c.dest,b.dest); c.nosc=b.nosr; for(intj=0;j<c.nosc;j++) { strcpy(c.pname[j],b.pname[j]); c.age[j]=b.age[j]; } strcpy(c.clas,b.clas); if(strcmp(c.clas,f)==0) {
  • 22. while(f1.read((char *) & a,sizeof(a))) { if(a.tno==c.tno) { a.c1=a.c1+c.nosc; d=a.d; m=a.m; addr=f1.tellg(); ad=sizeof(a.c1); f1.seekp(addr-(7*ad)); f1.write((char *) & a.c1,sizeof(a.c1)); tamt=b.amc; if((c.d==d)&&(c.m==m)) { cout<<"You are cancelling at the date of departuren"; c.amr=tamt-((tamt*60)/100); } else if(c.m==m) { cout<<"You are cancelling at the month of departuren"; c.amr=tamt-((tamt*50)/100); }
  • 23. else if(m>c.m) { cout<<"You are cancelling one month before the date of departuren"; c.amr=tamt-((tamt*20)/100); } else { cout<<"Cancelling after the departuren"; cout<<"Your request cannot be completedn"; } goto h; c.displaycancdet(); } } } else if(strcmp(c.clas,s)==0) { while(f1.read((char *) & a,sizeof(a))) { if(a.tno==c.tno) { a.c2=a.c2+c.nosc;
  • 24. d=a.d; m=a.m; addr=f1.tellg(); ad=sizeof(a.c2); f1.seekp(addr-(5*ad)); f1.write((char *) & a.c2,sizeof(a.c2)); tamt=b.amc; if((c.d==d)&&(c.m==m)) { cout<<"You are cancelling at the date of departuren"; c.amr=tamt-((tamt*60)/100); } else if(c.m==m) { cout<<"You are cancelling at the month of departuren"; c.amr=tamt-((tamt*50)/100); } else if(m>c.m) { cout<<"You are cancelling one month before the date of departuren"; c.amr=tamt-((tamt*20)/100); } else
  • 25. { cout<<"Cancelling after the departuren"; cout<<"Your request cannot be completedn"; } goto h; c.displaycancdet(); } } } } else { flag=0; } } h: if(flag==0) { cout<<"Enter the correctpnr non"; } f1.close(); f2.close();
  • 26. f3.close(); getch(); } void can() { int ch; do { cout<<".................CANCELLATIONMENU.........n"; cout<<"1.Cancelln2.Return to the main menun"; cout<<"Enter your choice:"; cin>>ch; cout<<endl; switch(ch) { case 1: cancell(); break; } }while(ch==1); getch(); } void user()
  • 27. { login a; int ch; cout<<"*****************************************************n"; cout<<"***********WELCOME TO THE USER MENU**n"; cout<<"****************************************************n"; char *password; fstreamf; f.open("id.txt",ios::in|ios::out|ios::binary); char id[100]; puts("Enter your id:");gets(id); puts("Enter your password:");gets(password); while(f.read((char *) & a,sizeof(a))) { if((strcmp(a.id,id)==0)&&(strcmp(a.pass,password)==0)) { do { cout<<"1.Reserven2.Cancelln3.Enquiryn4.Return to the main menun"; cout<<"Enter your choice:"; cin>>ch; cout<<endl;
  • 28. switch(ch) { case 1: reserve(); break; case 2: cancell(); break; case 3: enquiry(); break; } }while(ch<=3); goto j; } else { d=1; } } if(d==1) { cout<<"Enter your user id and password correctlyn";
  • 29. } getch(); j: } void manage() { int ch; fstreamf; char c; login a; cout<<".........WELCOMETO THEUSER MANAGEMENT MENU........n"; do { cout<<"1.Create id data basen2.Add detailsn"; cout<<"3.Display detailsn4.Return to the main menun"; cout<<"Enter your choice:"; cin>>ch; cout<<endl; switch(ch) { case 1: f.open("id.txt",ios::out|ios::binary);
  • 30. do { a.getid(); f.write((char *) & a,sizeof(a)); cout<<"Do you wantto add one morerecordn"; cout<<"y-Yesnn-Non"; cin>>c; }while(c=='y'); f.close(); break; case 2: f.open("id.txt",ios::in|ios::out|ios::binary|ios::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();