SlideShare ist ein Scribd-Unternehmen logo
1 von 13
OUTPUT FORMS:-
SOURCE CODE:-
#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
class HOTEL
{
int room_no;
char Name [30];
char Address[50];
char Phone[10];
int days;
int n;
int Total_fare;
char Date_Of_Booking[10];
public:
void menu();
void details();
void search();
void rooms_alloted();
void Modify_data();
void Room_Charge();
int check(int);
void modify(int);
void Bill();
void fare()
{
if(n==1)
Total_fare=1600*days;
else if(n==2)
Total_fare=1800*days;
else if (n==3)
Total_fare=1300*days;
else if (n==4)
Total_fare=1500*days;
} };
void HOTEL::menu()
{
int choose;
while(choose!=6)
{
clrscr();
cout<<"ntttt################";
cout<<"ntttt** MAIN MENU **";
cout<<"ntttt################";
cout<<"nnnttt1. Book A Room";
cout<<"nttt2. Data";
cout<<"nttt3. Show all room alloted";
cout<<"nttt4. Edit record";
cout<<"nttt5. Room charge";
cout<<"nttt6.Exit";
cout<<"nnttEnter Your Choice:";
cin>>choose;
switch(choose)
{
case 1:details();
break;
case 2:search();
break;
case 3:rooms_alloted();
break;
case 4: Modify_data();
break;
case 5: Room_Charge();
break;
case 6:break;
default:cout<<"WRONG CHOICE";
cout<<"Press Any Key To Continue";
getch();
}
}
}
void HOTEL::details()
{
clrscr();
int r,flag;
ofstream fout("HOTEL.dat",ios::app);
cout<<"Enter Customer Details";
randomize();
r=100+random(400);
room_no=r;
cout<<"Name";
gets(Name);
cout<<"Address";
gets(Address);
cout<<"Phone";
gets(Phone);
cout<<"Date of booking";
gets(Date_Of_Booking);
cout<<"How many days you stay";
cin>>days;
fout.write((char*)this,sizeof(HOTEL));
cout<<"Your room has been booked";
cout<<"n Room no:"<<room_no;
cout<<"Press Any Key To Continue";
getch();
fout.close();
}
void HOTEL:: Room_Charge()
{
cout<<"How many days you stay";
cin>>days;
cout<<"t1.SINGLE BED WITH AC: Rs 1600n";
cout<<"t2.DOUBLE BED WITH AC: Rs 1800n";
cout<<"t3.SINGLE BED WITH FAN: Rs 1300n";
cout<<"t4.DOUBLE BED WITH FAN: Rs 1500n";
cout<<"Enter your choice";
cin>>n;
fare();
Bill();
cout<<"Press Any Key To Continue";
getch();
}
void HOTEL::search()
{
fstream fin("HOTEL.dat",ios::in);
int r,flag;
cout<<"Enter room no.";
cin>>r;
while(!fin.eof())
{
fin.read((char*)this,sizeof(HOTEL));
if(room_no==r)
{
clrscr();
cout<<"Customer details";
cout<<"n";
cout<<"nn";
cout<<"Room no:"<<room_no;
cout<<"n";
cout<<"Name:"<<Name;
cout<<"n";
cout<<"Address:"<<Address;
cout<<"n";
cout<<"Phone no:"<<Phone;
flag=1;
break;
}
}
if(flag==0)
cout<<"nn Sorry Room no. not found or vacant...!!!";
cout<<"nn";
cout<<"Press any key to continue...!!!";
getch();
fin.close();
}
void HOTEL::rooms_alloted()
{
clrscr();
ifstream fin("HOTEL.dat",ios::in);
cout<<"nttt List of Room Alloted";
cout<<"nttt-------------------";
cout<<"nnRoom No.tNamettAddressttttPhone No.n";
while(!fin.eof())
{
fin.read((char*)this,sizeof(HOTEL));
cout<<"nn"<<room_no<<"tt"<<Name;
cout<<"tt"<<Address<<"tt"<<Phone;
}
cout<<"nnnntttttt Press any key to continue..!!";
getch();
fin.close();
}
void HOTEL ::Modify_data()
{
clrscr();
int m;
cout<<"t1.MODIFY CUSTOMER RECORD";
cout<<"enter room no";
cin>>m;
modify(m);
cout<<"nnnntttttt Press any key to continue..!!";
getch();
}
int HOTEL::check(int r)
{
int flag=0;
ifstream fin("HOTEL.dat",ios::in);
while(!fin.eof())
{
fin.read((char*)this,sizeof(HOTEL));
if(room_no==r)
{
flag=1;
break;
}
}
fin.close();
return(flag);
}
void HOTEL::modify(int r)
{
long pos,flag=0;
fstream file("HOTEL.dat",ios::in|ios::out|ios::binary);
while(!file.eof())
{
pos=file.tellg();
file.read((char*)this,sizeof(HOTEL));
if(room_no==r)
{
cout<<"n";
cout<<"Enter New details:";
cout<<"n----------------";
cout<<"n";
cout<<"Name:";
gets(Name);
cout<<"nAddress:";
gets(Address);
cout<<"Phone no:";
gets(Phone);
file.seekg(pos);
file.write((char*)this,sizeof(HOTEL));
cout<<"nRecord is modified!!";
flag=1;
break;
}
}
if(flag==0)
cout<<"n";
else
cout<<"Room no is wrong";
}
void HOTEL::Bill()
{
search();
cout<<"your fare"<<Total_fare;
}
void main()
{
HOTEL h;
clrscr();
cout<<"ntttt*WELCOME TO VILLA*";
cout<<"nnttPress Any Key To Continue";
getch();
h.menu();
}

Weitere Àhnliche Inhalte

Was ist angesagt? (12)

Newton's method for MATLAB Code
Newton's method for MATLAB CodeNewton's method for MATLAB Code
Newton's method for MATLAB Code
 
Real Life Uses of a Program (Tik Tok Toy Game) useing by C Programming
Real Life Uses of a Program (Tik Tok Toy Game) useing by C Programming Real Life Uses of a Program (Tik Tok Toy Game) useing by C Programming
Real Life Uses of a Program (Tik Tok Toy Game) useing by C Programming
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 
oop Lecture 4
oop Lecture 4oop Lecture 4
oop Lecture 4
 
C
CC
C
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
 
135
135135
135
 
Introduction to Processing and creative coding
Introduction to Processing and creative codingIntroduction to Processing and creative coding
Introduction to Processing and creative coding
 
Include
IncludeInclude
Include
 
Exp3
Exp3Exp3
Exp3
 
week-23x
week-23xweek-23x
week-23x
 
1 (1)
1 (1)1 (1)
1 (1)
 

Andere mochten auch

Semita - Sourcing for Growth 2-15
Semita - Sourcing for Growth 2-15Semita - Sourcing for Growth 2-15
Semita - Sourcing for Growth 2-15
Edmund Tann
 
Carlos_Zamora_2016_Resume
Carlos_Zamora_2016_ResumeCarlos_Zamora_2016_Resume
Carlos_Zamora_2016_Resume
Carlos Zamora
 
2013 SS wardrobe LRES
2013 SS wardrobe LRES2013 SS wardrobe LRES
2013 SS wardrobe LRES
Douglas Anderson
 
College Retention Rate Research
College Retention Rate ResearchCollege Retention Rate Research
College Retention Rate Research
Qai Gordon
 
CurrencyManipulationAssignment
CurrencyManipulationAssignmentCurrencyManipulationAssignment
CurrencyManipulationAssignment
Chelsea Williams
 
PresentationPatterns_v2
PresentationPatterns_v2PresentationPatterns_v2
PresentationPatterns_v2
Maksym Tolstik
 
ADEWUYI REUBEN ADEBARE CV
ADEWUYI REUBEN ADEBARE CVADEWUYI REUBEN ADEBARE CV
ADEWUYI REUBEN ADEBARE CV
Reuben Adewuyi
 
TAGD Bylaws Proposed Changes
TAGD Bylaws Proposed ChangesTAGD Bylaws Proposed Changes
TAGD Bylaws Proposed Changes
Beth Hood
 

Andere mochten auch (19)

Clearwater DFC
Clearwater DFCClearwater DFC
Clearwater DFC
 
Metcalf Resume
Metcalf ResumeMetcalf Resume
Metcalf Resume
 
Screen Size and You
Screen Size and YouScreen Size and You
Screen Size and You
 
Semita - Sourcing for Growth 2-15
Semita - Sourcing for Growth 2-15Semita - Sourcing for Growth 2-15
Semita - Sourcing for Growth 2-15
 
Carlos_Zamora_2016_Resume
Carlos_Zamora_2016_ResumeCarlos_Zamora_2016_Resume
Carlos_Zamora_2016_Resume
 
2013 SS wardrobe LRES
2013 SS wardrobe LRES2013 SS wardrobe LRES
2013 SS wardrobe LRES
 
Meet the Team
Meet the TeamMeet the Team
Meet the Team
 
College Retention Rate Research
College Retention Rate ResearchCollege Retention Rate Research
College Retention Rate Research
 
Multicom's Brochure
Multicom's BrochureMulticom's Brochure
Multicom's Brochure
 
Cv 280616
Cv 280616Cv 280616
Cv 280616
 
CurrencyManipulationAssignment
CurrencyManipulationAssignmentCurrencyManipulationAssignment
CurrencyManipulationAssignment
 
PresentationPatterns_v2
PresentationPatterns_v2PresentationPatterns_v2
PresentationPatterns_v2
 
What’s new in version 5 of AskoziaPBX? - webinar 2016, English
What’s new in version 5 of AskoziaPBX? - webinar 2016, EnglishWhat’s new in version 5 of AskoziaPBX? - webinar 2016, English
What’s new in version 5 of AskoziaPBX? - webinar 2016, English
 
Ibm
IbmIbm
Ibm
 
ADEWUYI REUBEN ADEBARE CV
ADEWUYI REUBEN ADEBARE CVADEWUYI REUBEN ADEBARE CV
ADEWUYI REUBEN ADEBARE CV
 
Resume
ResumeResume
Resume
 
Estigma
EstigmaEstigma
Estigma
 
TAGD Bylaws Proposed Changes
TAGD Bylaws Proposed ChangesTAGD Bylaws Proposed Changes
TAGD Bylaws Proposed Changes
 
Resume Carolyn 2015
Resume Carolyn 2015Resume Carolyn 2015
Resume Carolyn 2015
 

KĂŒrzlich hochgeladen

Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
MarinCaroMartnezBerg
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night StandCall Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
amitlee9823
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
amitlee9823
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
amitlee9823
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
AroojKhan71
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 

KĂŒrzlich hochgeladen (20)

Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night StandCall Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 đŸ„” Book Your One night Stand
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 

HOTEL MANGEMENT

  • 1.
  • 2.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. SOURCE CODE:- #include<iostream.h> #include<fstream.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<conio.h> class HOTEL { int room_no; char Name [30]; char Address[50]; char Phone[10]; int days; int n; int Total_fare; char Date_Of_Booking[10]; public: void menu(); void details(); void search(); void rooms_alloted();
  • 9. void Modify_data(); void Room_Charge(); int check(int); void modify(int); void Bill(); void fare() { if(n==1) Total_fare=1600*days; else if(n==2) Total_fare=1800*days; else if (n==3) Total_fare=1300*days; else if (n==4) Total_fare=1500*days; } }; void HOTEL::menu() { int choose; while(choose!=6) { clrscr(); cout<<"ntttt################"; cout<<"ntttt** MAIN MENU **"; cout<<"ntttt################"; cout<<"nnnttt1. Book A Room"; cout<<"nttt2. Data"; cout<<"nttt3. Show all room alloted"; cout<<"nttt4. Edit record"; cout<<"nttt5. Room charge"; cout<<"nttt6.Exit"; cout<<"nnttEnter Your Choice:"; cin>>choose; switch(choose) { case 1:details(); break; case 2:search(); break; case 3:rooms_alloted(); break; case 4: Modify_data(); break; case 5: Room_Charge(); break; case 6:break; default:cout<<"WRONG CHOICE"; cout<<"Press Any Key To Continue";
  • 10. getch(); } } } void HOTEL::details() { clrscr(); int r,flag; ofstream fout("HOTEL.dat",ios::app); cout<<"Enter Customer Details"; randomize(); r=100+random(400); room_no=r; cout<<"Name"; gets(Name); cout<<"Address"; gets(Address); cout<<"Phone"; gets(Phone); cout<<"Date of booking"; gets(Date_Of_Booking); cout<<"How many days you stay"; cin>>days; fout.write((char*)this,sizeof(HOTEL)); cout<<"Your room has been booked"; cout<<"n Room no:"<<room_no; cout<<"Press Any Key To Continue"; getch(); fout.close(); } void HOTEL:: Room_Charge() { cout<<"How many days you stay"; cin>>days; cout<<"t1.SINGLE BED WITH AC: Rs 1600n"; cout<<"t2.DOUBLE BED WITH AC: Rs 1800n"; cout<<"t3.SINGLE BED WITH FAN: Rs 1300n"; cout<<"t4.DOUBLE BED WITH FAN: Rs 1500n"; cout<<"Enter your choice"; cin>>n; fare(); Bill(); cout<<"Press Any Key To Continue"; getch(); } void HOTEL::search() { fstream fin("HOTEL.dat",ios::in); int r,flag; cout<<"Enter room no."; cin>>r;
  • 11. while(!fin.eof()) { fin.read((char*)this,sizeof(HOTEL)); if(room_no==r) { clrscr(); cout<<"Customer details"; cout<<"n"; cout<<"nn"; cout<<"Room no:"<<room_no; cout<<"n"; cout<<"Name:"<<Name; cout<<"n"; cout<<"Address:"<<Address; cout<<"n"; cout<<"Phone no:"<<Phone; flag=1; break; } } if(flag==0) cout<<"nn Sorry Room no. not found or vacant...!!!"; cout<<"nn"; cout<<"Press any key to continue...!!!"; getch(); fin.close(); } void HOTEL::rooms_alloted() { clrscr(); ifstream fin("HOTEL.dat",ios::in); cout<<"nttt List of Room Alloted"; cout<<"nttt-------------------"; cout<<"nnRoom No.tNamettAddressttttPhone No.n"; while(!fin.eof()) { fin.read((char*)this,sizeof(HOTEL)); cout<<"nn"<<room_no<<"tt"<<Name; cout<<"tt"<<Address<<"tt"<<Phone; } cout<<"nnnntttttt Press any key to continue..!!"; getch(); fin.close(); } void HOTEL ::Modify_data() { clrscr(); int m; cout<<"t1.MODIFY CUSTOMER RECORD";
  • 12. cout<<"enter room no"; cin>>m; modify(m); cout<<"nnnntttttt Press any key to continue..!!"; getch(); } int HOTEL::check(int r) { int flag=0; ifstream fin("HOTEL.dat",ios::in); while(!fin.eof()) { fin.read((char*)this,sizeof(HOTEL)); if(room_no==r) { flag=1; break; } } fin.close(); return(flag); } void HOTEL::modify(int r) { long pos,flag=0; fstream file("HOTEL.dat",ios::in|ios::out|ios::binary); while(!file.eof()) { pos=file.tellg(); file.read((char*)this,sizeof(HOTEL)); if(room_no==r) { cout<<"n"; cout<<"Enter New details:"; cout<<"n----------------"; cout<<"n"; cout<<"Name:"; gets(Name); cout<<"nAddress:"; gets(Address); cout<<"Phone no:"; gets(Phone); file.seekg(pos); file.write((char*)this,sizeof(HOTEL)); cout<<"nRecord is modified!!"; flag=1; break;
  • 13. } } if(flag==0) cout<<"n"; else cout<<"Room no is wrong"; } void HOTEL::Bill() { search(); cout<<"your fare"<<Total_fare; } void main() { HOTEL h; clrscr(); cout<<"ntttt*WELCOME TO VILLA*"; cout<<"nnttPress Any Key To Continue"; getch(); h.menu(); }