SlideShare una empresa de Scribd logo
1 de 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();
}

Más contenido relacionado

La actualidad más candente (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)
 

Destacado

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
 
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
 

Destacado (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
 

Último

Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
chadhar227
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
vexqp
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
vexqp
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
cnajjemba
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
vexqp
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
ptikerjasaptiker
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 

Último (20)

Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
SR-101-01012024-EN.docx Federal Constitution of the Swiss Confederation
SR-101-01012024-EN.docx  Federal Constitution  of the Swiss ConfederationSR-101-01012024-EN.docx  Federal Constitution  of the Swiss Confederation
SR-101-01012024-EN.docx Federal Constitution of the Swiss Confederation
 
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
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
 
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 

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(); }