Project in C++ (Hotel Management System)
Project in C++ (Hotel Management System)
Project in c++
HOTEL MANAGEMENT SYSTEM
CSE :202
ANKIT PAYAL
PAGE:-3
HOTEL MANAGEMENT SYSTEM
Contents:-
Introduction
Header files
Functions
Welcome to hotel
Get information
Additional features
References
PAGE:-4
HOTEL MANAGEMENT SYSTEM
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include <time.h>
#include<graphics.h>
void graphic();
void coupd();
void coup();
void gen();
void dlx();
void spd();
class room
protected:
int r_no;
int r_charge;
char r_cust[20];
char c_city[20];
int c_mem;
char c_nat[20];
char r_avail;
PAGE:-5
HOTEL MANAGEMENT SYSTEM
int r_per;
int no;
char type[20];
int charge;
char cust[20];
char avail;
int per;
int year;
int mon;
int day;
public:
char r_type[20];
char getavail()
return(r_avail);
void getr1()
r_no=1;
strcpy(r_type,"Sp Dlx");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
PAGE:-6
HOTEL MANAGEMENT SYSTEM
}
void getr2()
r_no=2;
strcpy(r_type,"Dlx");
r_charge=1000;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
void getr3()
r_no=3;
strcpy(r_type,"Gen");
r_charge=750;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
void getr4()
r_no=4;
strcpy(r_type,"Coupl");
r_charge=1250;
PAGE:-7
HOTEL MANAGEMENT SYSTEM
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
void getr5()
r_no=5;
strcpy(r_type,"C Dlx");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
void putinfo()
void modify()
cout<<"\n____________________________________________________________________________"
;
cin>>no;
cin>>type;
cin>>charge;
cin>>avail;
cin>>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
r_no=no;
strcpy(r_type,type);
r_charge=charge;
r_avail=avail;
strcpy(r_cust,cust);
r_per=per;
void allocate()
{
PAGE:-9
HOTEL MANAGEMENT SYSTEM
if(r_avail=='Y')
cin >>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
cin>>c_city;
cin>>c_nat;
cin>>c_mem;
cout<<"\n------------------------------";
cin >>year;
cin >>mon;
cin >>day;
strcpy(r_cust,cust);
r_per=per;
r_avail='N';
}
PAGE:-10
HOTEL MANAGEMENT SYSTEM
else
void putcust()
int i,j;
i=day+r_per;
j=strcmp(r_cust,"N.A");
if(j==0)
else
date(i,mon,year);
PAGE:-11
HOTEL MANAGEMENT SYSTEM
}
};
int i;
i=m%12;
if(i==0)
if(d>31)
d=d-31;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==1)
PAGE:-12
HOTEL MANAGEMENT SYSTEM
{
if(d>31)
d=d-31;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==2)
if(d>30)
d=d-30;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
PAGE:-13
HOTEL MANAGEMENT SYSTEM
}
else
if(i==3)
if(d>31)
d=d-31;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==4)
if(d>30)
{
PAGE:-14
HOTEL MANAGEMENT SYSTEM
d=d-30;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==5)
if(d>31)
d=d-31;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==6)
if(d>30)
d=d-30;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==7)
if(d>31)
d=d-31;
m=m+1;
PAGE:-16
HOTEL MANAGEMENT SYSTEM
}
if(m>12)
m=m-12;
y=y+1;
else
if(i==8)
if(d>31)
d=d-31;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
}
PAGE:-17
HOTEL MANAGEMENT SYSTEM
else
if(i==9)
if(d>30)
d=d-30;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
else
if(i==10)
if(d>31)
d=d-31;
m=m+1;
if(m>12)
PAGE:-18
HOTEL MANAGEMENT SYSTEM
{
m=m-12;
y=y+1;
else
if(i==11)
if(d>30)
d=d-30;
m=m+1;
if(m>12)
m=m-12;
y=y+1;
private:
long total;
int food;
long room;
float ser;
int t;
int oc;
public:
void calculate()
cin>>food;
cin>>oc;
ser=(int)(0.05*t);
total=t+ser;
void dispbill()
clrscr();
PAGE:-20
HOTEL MANAGEMENT SYSTEM
cout<<"\n_____________________________________________________________________________
___";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n ";
cout<<"\n ";
strcpy(r_cust,"N.A");
r_per=0;
r_avail='Y';
day=0;
PAGE:-21
HOTEL MANAGEMENT SYSTEM
mon=0;
year=0;
strcpy(c_city,"N.A ");
strcpy(c_nat,"N.A ");
c_mem = 0;
void check();
};
if(r_avail=='Y')
void main()
int i,ch;
bill R[5];
char c;
clrscr();
PAGE:-22
HOTEL MANAGEMENT SYSTEM
getch();
clrscr();
R[0].getr1();
R[1].getr2();
R[2].getr3();
R[3].getr4();
R[4].getr5();
textcolor(4+200);
textbackground(1);
time_t t;
clrscr();
t = time(NULL);
cout<<"\n "<<ctime(&t);
t -= 24L*60L*60L;
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
getch();
PAGE:-23
HOTEL MANAGEMENT SYSTEM
textcolor(10);
textbackground(4200);
xyz:
clrscr();
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n ";
cout<<"\n ";
cout<<"\n ";
cout<<"\n ";
cin >>ch;
if(ch>8)
clrscr();
PAGE:-24
HOTEL MANAGEMENT SYSTEM
cout<<"\n Wrong choice ....";
getch();
goto xyz;
if(ch==1)
clrscr();
for(i=0;i<=4;i++)
R[i].putinfo();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
PAGE:-25
HOTEL MANAGEMENT SYSTEM
else
goto mno;
else
if(ch==2)
abc:
clrscr();
int n;
cin>>n;
if(n>5)
getch();
goto abc;
n=n-1;
clrscr();
R[n].putcust();
getch();
clrscr();
cout<<"\n ";
PAGE:-26
HOTEL MANAGEMENT SYSTEM
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
else
if(ch==3)
pqr:
clrscr();
int a;
cin>>a;
if(a>5)
getch();
goto pqr;
a=a-1;
R[a].modify();
getch();
PAGE:-27
HOTEL MANAGEMENT SYSTEM
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
else
if(ch==4)
clrscr();
for(i=0;i<=4;i++)
R[i].check();
getch();
clrscr();
cout<<"\n ";
PAGE:-28
HOTEL MANAGEMENT SYSTEM
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
else
if(ch==5)
int b;
def:
clrscr();
cin >>b;
if(b>5)
getch();
goto def;
b=b-1;
R[b].allocate();
getch();
PAGE:-29
HOTEL MANAGEMENT SYSTEM
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
else
if(ch==6)
ghi:
clrscr();
int a,d,e,f,g,h;
char c;
char b[5];
cin>>a;
if(a>5)
getch();
PAGE:-30
HOTEL MANAGEMENT SYSTEM
goto ghi;
a=a-1;
strcpy(b,R[a].r_type);
d=strcmp(b,"Sp Dlx");
e=strcmp(b,"Dlx");
f=strcmp(b,"Gen");
g=strcmp(b,"Coupl");
h=strcmp(b,"C Dlx");
if(d==0)
spd();
else
if(e==0)
dlx();
else
PAGE:-31
HOTEL MANAGEMENT SYSTEM
if(f==0)
gen();
else
if(g==0)
coupd();
else
if(h==0)
coup();
getch();
clrscr();
cout<<"\n ";
PAGE:-32
HOTEL MANAGEMENT SYSTEM
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
if(ch==7)
stu:
clrscr();
int b;
cin>>b;
if(b>5)
getch();
goto stu;
char av;
av=R[b-1].getavail();
if(av=='Y')
PAGE:-33
HOTEL MANAGEMENT SYSTEM
{
getch();
goto stu;
else
R[b-1].calculate();
R[b-1].dispbill();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cin>>c;
if (c=='N')
goto xyz;
else
if(ch==8)
goto mno;
PAGE:-34
HOTEL MANAGEMENT SYSTEM
}
mno:
void spd()
clrscr();
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
PAGE:-35
HOTEL MANAGEMENT SYSTEM
void dlx()
clrscr();
cout<<"\n-------------------------------------------------------------------";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
void gen()
clrscr();
cout<<"\n------------------------------------------------------------------";
PAGE:-36
HOTEL MANAGEMENT SYSTEM
cout<<"\n\n Room Type >>> General ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
void coup()
clrscr();
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
void coupd()
clrscr();
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
cout<<"\n------------------------------------------------------------------";
PAGE:-38
HOTEL MANAGEMENT SYSTEM
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
void graphic()
clrscr();
int i=1,j;
int gmode;
initgraph(&gdriver,&gmode,"C:\\tc\\bgi");
for(i=1;i<100;i++)
for(j=1;j<=20;j++)
settextstyle(1,0,5);
setcolor(i);
outtextxy(0,50,"WELCOME");
setcolor(i+4);
outtextxy(100,100," TO");
setcolor(i+1);
outtextxy(200,150," HOTEL");
setcolor(i+2);
outtextxy(300,200," HONEYMOON");
setcolor(i+3);
outtextxy(400,250," INN");
PAGE:-39
HOTEL MANAGEMENT SYSTEM
}
References
E –Balagurusamy
Ashoke N Kamthane
www.planet-source-code.com/
www.codeproject.com/