SlideShare a Scribd company logo
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();
}

More Related Content

What's hot (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)
 

Viewers also liked

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
 

Viewers also liked (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
 

Recently uploaded

做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
Domenico Conte
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
StarCompliance.io
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage s
MAQIB18
 
Introduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxxIntroduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxx
zahraomer517
 

Recently uploaded (20)

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
Professional Data Engineer Certification Exam Guide  _  Learn  _  Google Clou...
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
Uber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis ReportUber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis Report
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage s
 
Introduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxxIntroduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxx
 

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