base.h
ifndef S
define S
includeiostream.h
includestdlib.h
includefstream.h
includestring.h
includeconio.h
class basezbase
protected:
int num;
char name30;
char city30;
public:
void insert;
void display;
base;
;
void base::insert
cout: ;
cin.ignore;
cin.getlinename,30;
whilestrcmpname,0
coutn,;
cin.getlinename,30;
coutn: ;
cin.getlinecity,30;
whilestrcmpcity,0
coutn,: ;
cin.getlinecity,30;
void base::display
base::base
numnum;
endif
booking.h
ifndef B
define B
includeiostream.h
includestdlib.h
includefstream.h
includestring.h
includeconio.h
includebase.h
includeresort.h
includehotel.h
class booking:public basebooking
private:
int phone;
int dno;
char email30;ID
char style30;
chardname30;
char ch30;
public:
void inserthotel s,resort k,booking w,char a;
void delhotel s,resort k,booking w;
void viewCity;
void printbooking w;
void writebooking w;
booking;
;
void booking::inserthotel s,resort k,booking w,char a
dno0;
dno;
systemcls;
ifstream finBooking.dat, ios::binary;
fin.seekg164,ios::end;
fin.readchar w,sizeofw;
fin.close;
coutnttn;
do
cout? HR: ;H,R
cinch;
whilestrcmpch,H!0strcmpch,R!0; HR
do
ifstrcmpch,H0H
cout: ;
else ifstrcmpch,R0R
cout: ;
cindno;
while!cc;
do
ifstrcmpch,H0H
do
coutR, D: ;
RD
cinstyle;
whilestrcmpstyle,R!0strcmpstyle,D!0; RD2
else ifstrcmpch,R0 R
c
coutR, D: ;cinstyle;
while!cc;
ifstrcmpch,H0H
ifstream finHotel.dat, ios::binary;
while!fin.eof
fin.readchar s,sizeofs;
ifnumnum
ifstrcmpstyle,R0s.bookbsum00
cout.;
else ifstrcmpstyle,D0s.bookhsum00
cout.;
else
strcpya,y;ay
ifstrcmpstyle,R0R
s.bookbsums.bookbsum1;1
else ifstrcmpstyle,D0D
s.bookhsums.bookhsum1;1
break;
ifstrcmpa,y!0 a!y
cout,.endl;
getch;
else
ofstream foutHotel.dat, ios::binaryios::ate;
fout.seekpfin.tellg;
fout.seekp88,ios::cur;
fout.writechar s,sizeofs;
fout.close;
fin.close;
else ifstrcmpch,R0R
ifstream finResort.dat, ios::binary;
while!fin.eof
fin.readchar k,sizeofk;
ifnumnum
ifstrcmpstyle,R0s.bookbsum00
cout.;
else ifstrcmpstyle,D0s.bookhsum00
cout.;
else
strcpya,y;ay
ifstrcmpstyle,R0R
k.rbookbsumk.rbookbsum1;1
else ifstrcmpstyle,D0D
k.rbookhsumk.rbookhsum1;1
break;
ifstrcmpa,y!0 a!y
cout,.endl;
getch;
else
ofstream foutHotel.dat, ios::binaryios::ate;
fout.seekpfin.tellg;
fout.seekp88,ios::cur;
fout.writechar s,sizeofs;
fout.close;
fin.close;
ifstrcmpa,y0ay
dno;
cout: dnoendl;
cout: ;
cin.ignore;
cin.getlinename,30;
whilestrcmpname,0
cout,: ;
cin.getlinename,30;
do
cout: ;
cinphone;
while!ccphone0;0
coutnEmail: ;
cinemail;
void booking::writebooking w
ofstream foutBooking.dat, ios::binaryios::app;
fout.writechar w,sizeofw;
foutflush;
fout.close;
void booking::delhotel s,resort k,booking w
ifstream finBooking.dat, ios::binary;
while!fin.eof
systemcls;
coutendl;
cout: ;
cindno;cout;
fin.readchar w,sizeofw;
if!fin.eofdno!w.dno
cout;
ofstream fout1Booking1.dat, ios::binaryios::app;
fout1.writechar w,sizeofw;
fout1.close;
else if!fin.eofdnow.dno
ifstrcmpw.ch,H0H
ifstream finHotel.dat, ios::binary;
while!fin.eof
fin.readchar s,sizeofs;
ifs.numw.num
cout;
ofstream foutHotel.dat, ios::binaryios::ate;
fout.seekpfin.tellg;
fout.seekp88,ios::cur;
ifstrcmpw.style,R0 R
s.bookbsums.bookbsum1; 1
else ifstrcmpw.style,D0D
s.bookhsums.bookhsum1;1
fout.writechar s,sizeofs;
fout.close;
break;
fin.close;
else ifstrcmpw.ch,R0 R
ifstream finResort.dat, ios::binary;
while!fin.eof
fin.readchar k,sizeofk;
ifk.numw.num
ofstream foutResort.dat, ios::binaryios::ate;
fout.seekpfin.tellg;
fout.seekp76,ios::cur;
k.rbookhsumk.rbookhsum1;1
fout.writechar k,sizeofk;
fout.close;
break;
fin.close;
fin.close;
ofstream foutBooking.dat, ios::truncios::binaryios::app;
ifstream fin1Booking1.dat, ios::binary;
while!fin1.eof
fin1.readchar w,sizeofw;
if!fin1.eof
fout.writechar w,sizeofw;
fin1.close;
fout.close;
ofstream fout1Booking1.dat;
coutendl;
void booking::viewCity
systemcls;
bool findfalse;
char city120;
cout: ;
cincity1;
coutendl;
hotel h1;
ifstream hotinHotel.dat,ios::in;
hotin.readchar h1,sizeofh1;
while!hotin.eof
if strcmpcity,city10
h1.displayh1,city1;
findtrue;
hotin.readchar h1,sizeofh1;
if strcmpcity,city1 ! 0
coutcity1 endl;
hotin.close;
coutendlendl;
findfalse;
coutendl;
resort r1;
ifstream vinResort.dat,ios::in;
vin.readchar r1,sizeofr1;
while!vin.eof
if strcmpcity,city10
r1.displayr1, city1;
vin.readchar r1,sizeofr1;
if strcmpcity,city1 ! 0
coutcity1 endl;
vin.close;
coutendl;
systempause;
booking::booking
endif
hotel.h
ifndef H
define H
includeiostream.h
includestdlib.h
includefstream.h
includestring.h
includeconio.h
includebase.h
bool ccint
char a20;
bool ftrue;
if!cin
cin.clear0;
cin.getlinea,20,n;
strcpya, ;
coutn,.endl;
getch;
ffalse;
return f;
class hotel:public basehotel
private:
int bsum;
int bprice;
int bookbsum;
int hsum;
int hprice;
int bookhsum;
public:
void insert2;
void displayhotel s,char a;
void printhotel s;
void writehotel s;
friend class booking;booking
;
void hotel::insert2
coutendl;
base::insert;insert
do
cout: ;
cinbsum;
while!cc;
do
cout: ;
cinbprice;
while!cc;
bookbsumbsum;
do
cout: ;
cinhsum;
while!cc;
do
cout: ;
cinhprice;
while!cc;
bookhsumhsum;
void hotel::writehotel s
ofstream foutHotel.dat, ios::binaryios::app;
ifstream finHotel.dat, ios::binary;
fin.seekg80,ios::end;
fin.readchar s,sizeofs;
s.insert2;insert
fout.writechar s,sizeofs;
foutflush;
fout.close;
cout;
void hotel::displayhotel s,char a
base b1;
b1.display;display
coutname;
cout: bsum: bprice: bookbsumendl;
cout: hsum: hprice: bookhsumendl;
endif
resort.h
ifndef R
define R
includeiostream.h
includestdlib.h
includefstream.h
includestring.h
includeconio.h
includebase.h
class resort:public base
private:
int rbsum;
int rbprice;
int rbookbsum;
int rhsum;
int rhprice;
int rbookhsum;
public:
void insert3;
void displayresort r,char a;
void printresort k;
void writeresort k;
friend class booking;booking
;
void resort::insert3
cout;
base::insert;insert
do
cout: ;
cinrbsum;
while!cc;
do
cout: ;
cinrbprice;
while!cc;
rbookbsumrbsum;
do
cout: ;
cinrhsum;
while!cc;
do
cout: ;
cinrhprice;
while!cc;
rbookhsumrhsum;
void resort::writeresort k
ofstream foutResort.dat, ios::binaryios::app;
ifstream finResort.dat, ios::binary;
fin.seekg76,ios::end;
fin.readchar k,sizeofk;
systemcls;
k.insert3; insert
fout.writechar k,sizeofk;
foutflush;
fout.close;
cout;
void resort::displayresort r,char a
resort r1;
ifstream finResort.dat, ios::binary;
cout;
while!fin.eof
fin.readchar r1,sizeofr1;
if!fin.eofstrcmpcity,a0
coutname;
cout: rbsum: rbprice: rbookhsumendl;
fin.close;
endif
main.cpp
includeiostream.h
includestdlib.h
includefstream.h
includestring.h
includeconio.h
include base.h
include hotel.h
include resort.h
include booking.h
int main
char n30;
whilestrcmpn,6!0
hotel s;hotels
resort k;resortk
booking w;bookingw
char a30;
cout endl;
coutn1:n2:n3:n4:n5:n6:nendl;
cout endlendl;
cout :;
cinn;
ifstrcmpn,10
s.writes;
systemcls;
else ifstrcmpn,20
k.writek;
systemcls;
else ifstrcmpn,30
w.inserts,k,w,a;
w.writew;
systemcls;
else ifstrcmpn,40
w.dels,k,w;
systemcls;
else ifstrcmpn,50
w.viewCity;
else ifstrcmpn,60
coutnendl;
cout!endl;
coutendl;
exit1;
else
coutn,.endl;
getch;
systemcls;
return 0;
Reviews
There are no reviews yet.