You are on page 1of 25

PRIGJYOTIU JUN IORCOLLEGE

TITABAR, JORHAT

ESTO: 2000

CERTIFICATE

nd
This is to certify that Prabin Dewan of H.S 2 year Science
bearing Roll 0499 No 20064 of Reg. N o.110608 Has completed
his project on "HOTEL MANAGEMENT SYSTEM" in the academic
year 2020-2021.

He has successfully prepared this Project report in the


Computer Lab of our College.

This Project may be considered as partial fulfillment of H.S.


syllabus conducted by the Assam Higher Secondary Educational
Council.

Teacher

Pragjyotika Junior College.


CONTENTS

Certificate from prlncipal---------------------------------I


Certificate from teacher---------------------------------11
Acknowledgement------------------------- - - - --'.-111
Project overview-------------------------------------------1
About C++ ---------------------------------------------------2-4
The Code -----------------------------------------------------5-24
Output Screen-------------------------- - - - - - -25-28
Conciusion---------------------------------------29
PROJECT OVERVIEW
This new hotel management hns been deve loped to meet all the processing
requirements which arc ne<:ded within th e hotel industry. This system will allow the hotel reception
department to mana ge all the record s of their customers and their payment in easy manner. The pcrso/
who will use thi s system will able to get all det ails on how to use the instruction in offiinc inodc, so
no need to take special training before using the system . All proper keywords have been used to
define eac h foncti on o f this nc-w system . To use thi s system , its users shou ld hnve a va lid password .

Once the correct password will be entered, verification process will be taken place at
the backcnd side and if entered password will be correct, admin will redirected to the next section.
,vhere they will ahlc to handle all the business activity using the computer system .

·n,e use the system for exact operations, admin will have lo enter the correct option
provided under the main menu screen . To perform all the operations related to any panieular
customers. admin will have to use the option number 2 which is available under customer detail. If
,-,c~ customers arrive to their hotel nnd their data need to be maintained. admin can append its details
to the customer' s n.'COrd file .

Existing system do not much 0exibility and reliability which has been provided ~y
th ~s new hotel management system . In the previous system oil records were saved in file under text
which can be easily rendnble by lhe other person if certain mistake l\as been done. Even if1he file is in
nead mode, its contents can he copied and changes can he mnde to that particular file. Getting
information on particular customer for each service which they have taken within their hotel was not
,,ossihle and mu ch manual processing task was done manually to final bill of a particular customer
before they check out from the hotel.

This new system will do all the processing tasks automaticall y. Admin will only ho ve
the responsibilit y to set the price of nil services which arc being provided within th ei r hotel premises.
Admin of the hotel will be provided with option to add, delete and modify the services which are
being provided by their hotel. During billing process, admin have to just enter their basic details for
various services which they hove taken. To make billing process easier, hilling secti on has been
divided into two parts, under first charges of room services will be prepared which will help
c ustomers to get final room services bill during their check out and food bill which can be paid by the
customers on dai ly basis or on weekly or monthly basis.
ABOUTC++
C++ (pronou nced as cec plut plus ) is 3 general-purpose program mi ng language. II has
imperative, ubj<.-c1-oricn1ed :ind gcnl!ric programming features. while also provid ing facilities for low-
leve l memory m.tnipu lati on.
,.,:
h was designed with o hillS toward sys1c:m programming and em bedded. rcsourcc-
con.strnincd Md large system s. with pcrfommncc. cllicicncy nnd fle xibi lity of use as its design
highlights. C-++ h1t..,;, al so been fo und u,;;cful in many other contcxtli, wi1h key strengths being soflwarc
infrastructure and resource-constrained applica tions, including desktop applications. servers (e.g. c-
commcru, web search or SQL servers). pcrfonnancc-critical npplications (e.g. telephone switches or space
probes), and cnlcrtainmcnt sonwarc. C+•t, is a compiled language. with implemen tations of ii available on
m:iny platfonns and provided by various org:.ini7.3.1ions. including
the FSF.LLVM. Mi crosoft Intel and IBM .

C++ is standantizcd by the International Organiza1ion for Standardi7..alion (ISO). with the
latest (and current) standard version ratified and published by ISO in December 20 14 as /SOI/EC
: 4882:2014 (informally known as C+-+- 14). 1111: C++ programming language was initially st1mdardi1.t:d in
1998 as /SOI/EC I J882: 199.S, which wns lhcn amended by 1he C++OJ, ISOI/F.C I J~8]: 2003. standard .
The currcnl C++ 14 standard supersedes these and C++ 11, wilh new features and an enlarged standard
library. Before the initial standardization in 1998. C t-+ wns developed by Bjame Slroustrup at flcll
Ulbs since 1979. as an ex tension of the C language a-. he wanted an cfficicnl and ncxiblc language similar
to C. which also provided high•lcvel features for program 011;ani 1..111ion.
Many olher programming languages have be-en influenced by 1• including CII, Java.
and newer versions ofC (after 1998).

His~ory

Ojame Stroostrup, the creator of C 1--+

lljarnc Strouslrup, a Danish computer scicn1is1, began his work on CH'~ predecessor NC with Cla..<;!CS~ in
1979. The moti vation for creating a new language originalcd from S1roustrup's experience in programming
for his l>h.D. thesis. S1roustrup found that Simula had features 1ha1 were very helpful for large so ftware
developmenl, bu1 1he langungc was 100 slow fo r praclical use. while 8CPL was fast bul loo low-level to be
suitable for large software development. When Stroustrup started working in AT&T Bell Labs, he h°ad the
problem ofanal yz.i ng the UNIX kernel wiLh respect to distributed computing. Remembering his rh.D.
experience. S1roustrup ~I out 10 enhance the C language with Simula-- like features. C was chose n because
ii was gcnernl•purposc. fast. ponablc and widely used. As well as C :md Simula's influences, other
languages also innuenccd Ct+, including ALGOL 68, Ada. CLU and ML.

In itially. 1hc class. derived class, strong 1yping, inlining and default argumcnl features
were added 10 C via Strous1rup's "C with Cla.,ses" to C compiler, Cpre .

- - - -- --{
In 1983. ii wa~ renamed from C with C/a.'ises to Ctt ("++" being the increment
operator in C). N ew features were added including virtual fun ctions. function name and operator
overloading, references, conslants. lypc-safc free-store memory alloca1ion (new/dclc1c), improved lype
checking. and BCPL style single-line comments with 1wo forward sla,;hes (//), as we ll as the development

of a proper comj,ilcr for C++. Cfronl.


ln 1985, the first edition of The C+4 Programming Language was released. which became the definitive
reference for the language. as there was not yet an oflicial standard. The first commercial implementation
of C++ was released in October of the same year.
In 1989, C++ 2.0 was released, followed by lhc updaled second edition of The
Programming Lo11g11age in 1991. New features in 2.0 included multiple inheritance, abstract classes, s1a1ic
member function s. canst member function s, and protected members. In 1990. 71se Annotated C r+
Reference Mam,al was published. This work became the basis for the future s1andard . Later fea1ure
additions included templates. exceptions. namcspaces, new casts, and a boolean type.
Afte r the 2.0 update, C++ evolved relalively slowly. In 2011 , 1he C++I I slandard was
released, adding numerous new features. enlarging the standard library further. and providing more
facilities to C++ programmers. Aficr a minor C++14 update, released in December 2014, various new
addilions are planned for 201 7.

Etymology
According to Stroustrup: "the name signifies I.he evolutionary nature of the changes from
C". This name is cn:dited 10 Rick Mascitti (mid-1983) and was firs1 uocd in December 1983. When
Mascitti was questioned informally in 1992 about the naming. he indicated that ii was given in a tongue-in-
.. cheek spirit. The name stems from C's"++" operator (which increments the value of a variable) and a
common naming convention of using "+" to indicate an enhanced computer program.
During C++'s devclopmen1 period. lhe language had been referred 10 as "new C" and ·c
wilh Classes" before acquiring ils final name.

Philosophy
Throughoul C++'s life, ils development and evolution has been infonnally governed by a
sci of rules lhal its evolution should follow :

II musl be driven by actual problems and ils features should be useful immediately in real world

programs.
Every fealure should be implementable (wilh a n:asonably obvious way to do so).
Programmers should be free 10 pick lheir own programming style, and thal slyle should be fully
supported by C++.
Allowing a useful fcalUn: is more im portanl than prevcnling every possible misuse ofC++.
It should provide facilili es for organizing programs into well-defined separate parts, and provide
facilities for combining separa1cly deve loped parts.
No implicit violations of the lype syslcm (bul allow cxplicil violations; lhnt is, those explicitly
requested by 1he programmer).
User-crea1cd types need to have the same suppon and perfomiance a.s built-in 1ypcs.
Unused features should not negati vely impact created executables (e.g. in lower performance):
There should be no language beneath C++ (cxccpl nsscmhl y language):
• C+-+ should work a longs ide other existing programming langu.:igcs. rather than fo stering its own
se para1c and incompatib le programmin g environm ent.
If the progra~1mcr's intent is unknown. all ow the programme r to spec ify it by provi ding manual

comro l.

C-H- is s1:1.ndardizcd by an ISO working group kno"-n a.'i JTC I/SC 22/WG2 I. So fa r. ii has seen five
vcr..ions o f C+t- re leased and is currentl y working on releasing C++ 17.

In 1998, lhc JSO working group standardized C++ fo r the first 1ime as /SO/tic /4 88}: / 998, which is
infonnall y knm,-n as c~ +98. In 2003 . it publis hed a new version of the C++ stand ard called !SOI /EC
/4881:1003. which fixed prohlcm s identified in C++98.
In 2005 , a technical report Wt\S released. ca lled the "Library Technical Report I" (TR I). While not an
official part of the standard. ii proposed a number of extensions to the standard library.

Thc· ocx t major revisi on o f the standard was informally referred 10 as "CH-Ox". but ii was not released until
"201 l. C++ I I ( 14 882:20 11 ) included most of the library enhanceme nts of TR I, as well as many add iti ons

10 the core langua(;.C .


In 20 14. C++ 14 (al so known as C++ Iy) was released as a sma ll cxiension to C++ 11.
featuri ng mainly bug fix es and small improve ments. The Dra0 ln1 cmati onal Standard ba\101 procedures

co mpleted in mid -August 201 4.


A 0 cr C++ l4, a major revision. informa lly known as C++ l 7, is pl anned for 20 17. As part
o f the standardizalion process. lhe ISO publishes several kinds of publications. In particular, technical
reports and technical specifications arc published when "there is the future but not immediate possibility of
an agrremenl to pu bli ~h an Int ernational St,rncfarc1." Until 2011 , three tec hnical reports on C++ we re
pub li~hcd : TR 19768 :2007 (a lso known as the C++ Technical Repo rt I) on library extensions mostly
integrated inlo C++ 11 , TR 29124 :2010 on special mathematica l function s, and TR 24TI3 :201 I on decimal
floating point arilhmeti c. The tcchnicn l specification DTS 18822 :201 4 (on fil e system operatio ns) was
approved in early 20 15. and more tec hnica l specifications are in dcvc lopmcnl and pending approv11l .

- - - - - - -(
C..QDDING
'
ll~••••••••••••••••••••••••••••••••••••••••••••••
II PROJECT HOTEL-MANAGEMENT

11••·········•!·•································

11••··························
II INCLUDED HEADER FILES
11••··························

~foclude<iostream.h>
#iriclude<conio.h>
#include<string.h>
"'ilinclude<graphics.h>
··#include<dos.h>
#include<stdio.h>
#include<fstream .h>
#includc<iomani p.h>
#include<stdlib.h>

11••·············~····························
II THlS CLASS CONTAINS FUNTIONS FOR FOOD

11••··········································
-~lass food
,t
private:
fstream pl;
int c;
char ap;
struct fd
{
char nam~[55];
float price;
}f;
,public: , ,·
food()
f
c=O;
}
void food_menu(void);
void app_fmenu(void);
void food_bill();
void del_all():
};
11••····················································
II FUNCTION FOR DISPLAYING FOOD MENU
ll•••••••••••••••••••••••••••••••••••••••••••••••••••••

5
void food ::food_mcnu(void)
' {
cleardcv ice();
setfillstylc(7, I);
floodfill(0,0,4);
sctfil_lstyle(7, IO);
bar( 17,40,605,420);
rectangle( 17,40,605,420);
setfillstyle( I , I 0);
bar(24,47,S98,4 I 3);
rcctllngle(24,47,598,413);
p I .close();
c=0;
p I .opcn("food.txr ,ios::inJios::hinary);
outtcxtxy(30,50,"S.N. ITEM NAME PRICE");
gotoxy( 4,S);
char h[S] ,pr[ 15];
whilc(p I .read(( char*)&f,sizcof(f)))
{
c++;
scttextstylc(4,0.1 );
,
1
itoa( c,h, I 0);
, , outt.extxy(40,60+20•c,h);
outtcxtxy( I S0,60+20•c.f.namc);
itoa(f.pricc,pr. IO);
outtextxy(390,60+ 20 •c,pr);
}//END OF WHILE
p I.close();
settextstylc( I 5,0, I);
outtextxy(J0,325,"DO YOU WANT TO ADD AN ITEM - (YIN )");
gotoxy(60,20);
cin>>ap;
iftap= 'y'llap= 'Y')
{
app_fmenu();
//CALLING APPEND FUNCTION
}
else
{
if(ap='n'llap= 'N')
{
outtcxtxy(J0,360,"DO YOU WANT TO DELETE ALL (YIN)");
char ch;
gotoxy( 60,23 );
cin>>ch;
ift ch= 'y'llch""='Y')
(
del_nll();
//CALL ING DELETE FUNCTION
)

ll•••••••••••••••••••••••••••••••••••••••

--l( 6 )1 -- -- - - - -
// FUNCTION TO APPEND IN FOOD MENU
ll••••••~••••••••••••••••••••••••••••••••
void food::app_fmcnu(void)
{
p I .o!)t:n("food.txt" ,ios: :applios: :binary);
outtcxtxy(J0,360,"ENTER ITEM NAME U WANTI'O ADD");
gotoxy( 60,23);
gets( f.name );
outtcxtxy(30,380,"ENTER THE PRICE");
gotoxy(60,24);
cin>>f.price;
pl .writc((char*)&f,sizeof{f));
p I.close();
getch();
- , }- , 1

H•••••••••••••••••••••••••••••
// FUNCTION FOR FOOD BILL
. ,'!••···························
void food::food bill()
{ -
double bill=- 1;
char c_ name[20],f_name[20];
int dt;
cleardcvice();
sctfillstyle(7, 1);
tloodfill(0,!),4);
setfillstyle(7, IO);
'bar(l 7,40,605,420);
rectangle( 17,40,605,420);
setfillstylc( I, 7);
bar(24,47,598,413);
rectangle(24,47,S98,413);
setcolor(4 );
settextstyle(7,0, I);
outtextxy(30,70,"ENTER CUSTOMER NAME");
gotoxy(S0,6);
cin>>c name;
outtextxy(J0,120,"ENTER ITEM NAME TAKEN");
gotoxy(S0,9);
cin>>f name;
outtext; y(30, 170,"ENTER THE QUANTITY");
gwoxy(50, 12);
cin>>dt;
p I.close();
p I .opcn("food.txt",ios:: inlios: :binary);
whilc(p I .rcad((char*)&f,sizeof(f)))
{
if{strcmp(f.name,f_name)==0)
(
bill=dt*f.price;
l
}//END OF WHILE

7
if(bill=- 1)
{
setcolor( I);
for(int i=0;i<20;i++)
{ .
setcolor( I);
outt cxtxy(30,220,"ITEM IS NOT PRESENT");
delay( I 00);
setcolor(WIDTE};
outtcxtxy(30,220,"ITEM IS NOT PRESENT");
delay( I00);
// delay(2500);
}
}
else
{
char t[5],b[5];
setcolor( I);
itoa( dt,t, IO);
itoa(bill,b, 10);
outtextxy(30,250,"N AME FOOD.NAME QUANTITY BI LL ");
setcolor( I );
scttcxtstyle( 4,0, I);
· outtcxtxy(30,280,c_name);
outtcxtxy( 140,280,f_ name);
outtextxy(320,280,t) ;
o uttextxy( 445,280,b );
getchO;
11••··································
// FUNCTION TO DELETE FOOD MENU
11••····························
void food::del_all()
{
remove("food.txt");
p 1.open("food.txt" ,ios::out);
p I .close();
c=O;
//END OF CLASS FOOD
ll••••••••••••••~••••••••••••••••••••••••
// THIS CLASS CONTAINS INFORMATION
// RELATED TO CUSTOMER
11••········•·*······..........................
class customer
{ ,
private:' '
intq,w;
8
fstream fl;
· stmcl cust
l {

.int c_no;
· char c _ name[20] ;
char c_add[80];
int a_date;
int a_month;
int a__year;
inl d_datc;
int d_month;
int d__year;
int room_no;
char room_typc[25];
}p;
public:
foodj;

custo~er()
{ .,
p.c_no=O;
p.d_date=O;
p.d_month=O;

II FUNCTION FOR CUSTOMER BILL


11••···························
inline void customer::cust_bill()
{
int cho;
1:f,p
cleardevice();
fl .close();
setfillstyle(7, I);
floodfill(0,0,4 );
setfillstyle(7, IO);
bar( I0, 70,600,450);
rectangle( I 0, 70,600,450);
setfillstyle( I, 7);
bar(l 7,77,593,443);
rectangle( 17,77,593,443);
setcolor(S);
setfillstyle( 1,2);
scttextstyle(7 ,0, I);
selcolor(9);
setfi llstyle( 1,2);
bar(2 I 0, 140,4 I0,238);
rectangle(210, 140,410.158);
rectangle(210, 140,410,174);
rectangle(2 I 0, 140,410, 190);
rcctangle(210, 140.410,206);
rectangle(2 I 0.140.410,222);

( 9 )t-- - -
rectangle(2 I 0, 140,410,238);
setcolor(4);
settextstyle( 1,0,4);
outtextxy(\80,20,"HOTEL BILL");
line( 180,60,383,60);
setcolor( 4);
settextstyle( 1,0, I);
outtextxy(210,l37," I. ROOM BILL");
outtextxy(210,170," 2. FOODBJLL");
outtextxy(210,200," 3. MAIN MENU");
outtextxy(63,318, "ENTER CHOICE FOR WHICH YOU WANT THE BILL");
gotoxy( 67 ,21 );
cin>>cho;
choose(cho); .
}while(cho!=3);//END OF WHILE

void choose(int a)
{
switch(a)
{

case I:

room_bill();
break;

case 2:
{
j.food_ bill();
break;
}
case 3:
break;

11••··························
// FUNCTION FOR ROOM BILL
11••······················
void room_billO
{
double bill;
int days,no,dt,mth;
cleardcvice();
setfi llstyle(7, I);
floodfill(0,0,4 );
setfillstyle(7, I 0);
bar( 17,40,605,420);
rectangle( 17,40,605,420);
setfillstyle( 1,7);
bar(24.47,598,413);
rectangle(24,4 7,598,413);

10
setcolor(4 );
settextstyle(7,0, I);
outtextxy(J0,70,"ENTER CUSTOMER NO DEPARTrNG");
gotoxy(50,6);
cin>>no;
outtextxy(30, 120,"DA TE OF DEPARTURE");
gotoxy(50,9);
cin>>dt;
outtcxtxy(30, 170,"MONTH OF DEPARTURE");
gotoxy(50, 12);
cin>>mth;
ifl.p.a_ month>mth)
{bill=O;
)
fl .close();
fl .open(''cust.txt".ios::inlios: :binary);
int c=O;
while(fl .read((char•)&p,sizeof{p)))
{
if{p.c_no=no)
{ c++;
if{p.a_ month=mth)
(
days=dt-p.a_ date;

else

days=(mth-p.a_ month)•3o+(dt-p.a_date);
)
if{p.room_no<I I)
{
char d[.5.] ,m[5].h(5),mt[5),dy(5] ,bl(5];
bill=days•250;
setcolor( 4);
outtextxy(J0,270," NAME ARRIVAL DEPARTIJRE DAYS rN
BILL");
setcolor( I );
scttextstyle( 1,0, I);
outtextxy(40,300,p.c_name);
itoa(p.a_date,d, IO);
outtcxtxy( 150,300,d);
outtextxy( 160.300, "/");
itoa(p.a_ month ,m,l 0);
outtcxtxy( 170,300,m);
itoa(dt,h, IO);
outtcxtxy(270.300,h);
outtcxtxy(280,300,"/");
itoa(mth ,mt, I 0);
outtextxy(290,J00,mt);
itoa( days,dy, IO);
outtextxy( 405,300,dy);
itoa(bill,bl, I 0);
outtcxtxy(515J00,bl);

ul sc

11 }- - ----------
char d[5],m[S],h[5],mt[5],dy[S],bl[5);
bill=days• 150;
setcolor(4);
outtextxy(30,270," NAME ARRIVAL DEPARTURE DAYS IN
BILL");
sctcolor( I);
settextstyle( 1,0, I);
outtextxy(40,300,p.c_name);
itoa(p.a _ date,d, IO);
outtextxy( I 50,300,d);
outtextxy( 160,300,"r');
itoa(p.a _ month,m, IO);
outtextxy( 170,300,m);
itoa(dt,b, 10);
outtextxy(270,300,h);
outtextxy(280,300,"/");
itoa(mth,mt, IO);
outtextxy(290,300,mt):
itoa(days,dy, IO);
outtextxy(405 ,3 00,dy);
itoa(bill,bl, IO);
outtextxy( 510,300,bl);
l
fl .close();
int count=l ;
fl .open("cust.txt",ios:: inl ios::binarY);
fstream 1'2;
while(fl .read((char•)&p,sizeof(p)))
{
if(p.c_no=no)
{
continue;

else
{
12.open("dup.txt",ios::applios:: binary);
p.c_no=count;
f2.write((char• )&p,sizeof(p));
count++;
1'2.closc():
)
}//END OF WMILE
remove("cust.txt");
rename("dup.txt","cust.txt");
fl .close(); ·
}
}//END OF WHIL E
if(c= 0)
{ for{int i=0;i< I0;i++)
{
settextstyle( 1,0,3 );
setcolor{ 4 ):
ounextxy(IS0,300,"C USTOMER IS NOT PRESENT"):
delay( I00); setcolor(WHlTE);

12
outtextxy(l50,300,"CUSTOM ER IS NOT PRESENT");
delay( 100);
l

gctch() ;

11••····································
II FUNCTION TO DISPLAY CUSTOMER DETAIL
11••····································
void cust_dctai I()
{
int c;
do
{
cleardcvice();
setfiJlstylc(7, I ):
Ooodfill(0,0,4);
setfillstylc(7,I 0);
bar( 50,80,600,4 70);
rectangle(50,80,600,470);
setfillstyle( I,7);
bar(57 ,87,593,463);
rectangle( 57,87,593,463 ):
setcolor(9);
setfillstylc(l ,2);
bar(2 10, 140,410,254);
rectanglc(210, 140,410,158);
rectangle(210, 140,410,174);
rcctangle(2 I 0, 140,410,190);
rectangle(210, 140,4 \ 0,206);
rectangle(2 l 0, 140,410,222);
rectangle(2 l 0, 140,410,238);
rectanglc(2 I 0, 140,410,254);
setcolor(4);
settextstyle( 1,0,4);
outtextxy(l60,20."CUSTOMER DETAIL");
setcolor( 14 );
line(l 63 ,60,475,60);
setcolor(4 );
settextstyle( 1,0, I);
outtcxtxy(225, 137," C HOICES ARE :-");
setcolor{ 4 );
sett'extstylc( 1,0, I);
outtextxy(2 I 0, 154," I . APPEND");
outtcxtxy(2 l 0, 170," 2. MODIFY");
outtextxy(2 I 0, 186." 3. DELETE ");
outtextxy(210,202," 4. DELETE ALL");
outtex.txy(2 I0,218," 5. DISPLAY ");
outtextxy(210,234," 6. MAIN MENU");
setcolor( 4 );
settextstyle(7,0,2);

--- - --l( 13
outtcxtxy(2 I 0,300,"ENTER CHOICE :-");
gotoxy(S3,20);
cin>>c;
switch(c)
{
ease I:
(
cust_app();
break ;

case 2:
(
cust_mod();
break;

case 3:
{
cust_del();
break;

case 4 :
{
cust_adel();
break;

case 5:
{
cust_<lisp();
break;

}
}while(c!=6);//END OF WHlLE

ll•••••••••••••••••••••••••••••••••••
II FUNCTION TO APPEND CUSTOMER
11••·································
void cust_app()
{
int ten,temp;
cleardevice();
n .open("cust.txt",ios::app\ios: :binary);
fl .seekg(0,ios: :end);
ten=fl .tellgO'sizcof(p);
p.c_ no=ten+ I;
setfillsiyle(7, I);
floodfill(0,0,4 );
sctfillstyle(7, IO);
bar( 17,50,605,4 70);
rcctangle(l 7,50,605,470);
setfil Istyle( I, 7);
bar(24,57,598,463);
rectangle(24,57,598.463 };
sctcolor(4);

14
settextstyle(7,0, I);
outtextxy(30, 70,''NAME ");
gotoxy(50,6);
cin>>p.c_ name;
outtextxy(30, 120,"ADDRESS");
gotoxy(50,9);
gets(p.c_add); .
outtextxy(30, 170,"DA TE OF ARRIVAL");
gotoxy(50, 12);
cin>>p.a_date;
outtextx.y(J0,220," MONTH OF ARRIVAL");
gotoxy(50, I 5);
cin>>p.a_ month;
outtextxy(J0,270,"YEAR OF ARRIVAL");
gotoxy(50, I 8);
cin>>p.a_year;
p.room_ no=tcn+ I ;
fl .write((char*)&p,sizeof{p));
n .close();

11••·····················~····••*••·············
// FUNCTION TO DISPLAY CUSTOMER IN HOTEL
11••············································
void cust_disp()
{
clcardevice();
fl .close();
setfillstyle(7, I);
flood ti 11(0,0,4 );
setfillstyle(7, JO);
bar(20,20,620,4S0);
rectangle(20,20,620,450);
setfillstylc( l , 7);
bar(27,27,613,443);
rectangle(27,27,613,443);
setcolor(4 );
setfillstyle( 1,2);
settextstyle(7,0, I); ,
outtextxy(25,40," CUST NO NAME ADORES~ ROOM.NO DATE"); ·
gotoxy(J0,3); ·
intc=O;
fl .open("cust.txt",ios::inlios:: binary);
fl .seekg(O,ios: :beg);
char h[5],pr[5],d[5] ,m[6] ;
while(fl .read(( char*)&p,sizeof{p)))
{
c++;
setcolor( I );
settextstyle( 1,0, I);
itoa(p.c_ no,h, IO);
outtcxtxy( 5 S,50+ 20*c,h);
outtextxy(J60,50+20*c,p.c_name);
outtextxy(280,50+ 20*c,p.c_add);

- - - - - - - - - - - -- -~ ( 15
itoa(p.room_no,pr, IO);
outtextxy(440,50+20•c.pr);
itoa(p.a_ date,d, IO);
outtextxy( 550,50+2o•c,d):
outtextxy(560,50+ 20*c, "/");
itoa(p.a_month,m, 10);
outtextxy(570,So+20*c,m);
}//END OF WHILE
getchO;
n .close();
v••••••••••••••••••••••••••••••••••••••••••••••••
II FUNCTION FOR MODIFYING CUSTOMER DETAIL
v••••••••••••••••••••••••••••••••••••••••••••••••
void cust_mod()
{
cleardevice();
n .close();
setfillstyle(7, I);
floodfill(0,0,4);
setfillstyle(7, I 0);
bar( I 0, I 0,600,470);
rectangle( I 0, I 0,600,4 70);
setfillstyle( l, 7);
, bar(l7, 17,593,463);
rectangle(l 7, 17,593,463);
setcolor(9);
sctfillstyle{ 1,2);
setcolor(4);
int no;//,count=O;
outtextxy(3 0,42,"ENTER CUSTOMER NO TO BE MODIFIED" );
gotoxy(65,4);
cin>>no;
n .open("cust.txt",ios::inlios::binary);
whilc(fl .rcad((char•)&p,Si7.COf(p)))
{
if(p.c_ no=no)
{
n.closcQ;
int num=sizeof(p )*(no-I);
fl .open("cust.txt" ,ios: :outlios::atejios::binary);
n .seekp(num,ios::beg);
outtextxy(30, 11 O,"ENTER NEW RECORD");
outtextxy(30, 150."NAME");
gotoxy(30, 11 );
cin>>p.c_name;
outtextxy(J0,200,"ADDRESS");
gotoxy(JO, 14 );
cin>>p.c add;
outtextxy(J0,250,"DATE");
gotoxy(JO, 17);
cin>>p.a_ date;
outtcxtxy(J0,300,"MONTI-I");
- - - -- - - { 16 } - - - - -
gotoxy(30,20);
cin>>p.a_ month;
outtextxy(30,3 50,"YEAR");
gotoxy(30,23);
cin>>p.a_year;
n .write((char*)&p.sizcof(p));
fl .closeO;
}
}//END OF WHlLE
gctch();
11••···············································
II FUNCTION TO DELETE ALL CUSTOMER RECORDS
11••···············································
void cust_adclO
{
remove(" cust.bet");
fl .open{"cust.txt" ,ios: :outj ios: :binarylios:: in);
p.c_no=0;
p.room_ no=O;
ll•••••••••••••••••••••••••••••••••••••••~••••••
// FUNCTION TO DELETE A CUSTOMER RECORD
11••············································
void cust_del()
{
cleardevice();
11 .close();
setfillstylc{7, I);
,tJoodfill{0,0,4);
-~·e nillstyle(7, J 0);
bar( I 0, I 0,600,470);
rectangle( I 0, I 0,600,470);
s~tfi llstyle( I ,7);
bar( 17, 17,593,463);
rectangle(l 7, 17,593,463);
setcolor(9);
setfillstyle( 1,2);
setcolor(4 );
int no,count= I;
outtextxy(30,42;"ENTER CUSTOMER NO TO BE DELETED");
gotoxy(65 ,4);
cin>>rio;
fl .open("cust.txt",ios:: inlios::binary);
fstream f2 ;
while(fl .read((char•)&p,sizeof( p)))
{
if(p.c_no==no)
{
continue;
17
else
{
f2 .open("dup.txt" ,ios: :applios: :binary);
p.c_no=count;
f2 .write((char*)&p,s izeof(p) );
count++;
f2.close();

)remove( "cust.txt ");


rename("dup.txt" ,"cust.txt");
fl .close();
getch() ;

};
//END OF C LASS CUSTOM ER
11••························••*············
// THIS CLASS CONTAINS INFORMATION
·11 ·ABOUf HOTEL
11••·······································
class hotel
{
private:
fstream fl ;

struct cust
{
int c_no;
char c_na.me[20] ;
char c_add[20] ;
int a_date;
int a_month;
int a_year;
intd_date;
int d_month;
int d_year,
int room_no;
char room_typc[25];
)x;

public:
);
//END OF CLASS HOTEL

11••·········································
// CLASS CONTROLLING ALL THE CLASSES
11••···················••*•··················
class control
{
private:
int ch;

public:

- - - - -( 18 }-- - - - - - -
hotel h;
· customer cust;
foodd;

II FUNCTION FOR PASSWORD


11••······"!'··················
void pass()
{

char passw(20];
for( ;;)
{
hot_name();
setcolor( 4);
setfillstylc(7, I);
floodfill(0,0,4);
setfillstyle(7, l 0);
bar(S0,60,600,450};
rectangle( 50,60,600,4 SO);
setfillstyle( I,7};
har(57,67,593,443};
rectang)e(57,67 ,593,443 );
setcolor( 4);
settextstyle(7 ,0, I);
settextslyle(7 ,0,2) ;
outtextxy(200,220,"ENTER PASSWORD :-");
gotoxy(55, 15);
cin>>passw;
if (strcmp(passw,"a")=O)
{
cleardevice();
break;

else

setcolor(4);
settcxtstyle(7 ,0, I);
for(int i=0;i< I0;i++)
{
setcolor(4);
outtextxy(200,320,"ENTER CORRECT PASSWORD");.
delay( I 00);
setcolor(WHITE) ;
outtextxy(200,320,"ENTER CORRECT PASSWORD");
delay( l 00);
settextstylc(7,0, I);
outtextxy(200,340,"PRESS ANY KEY TO CONTINUE");}
cleardevice();

}
do
l
ch=mmenu();
choicc(ch);

- - - - - - -- - { 19
)while(ch!=5);//END OF WI IILE

n•••••••••••••••••••••••••••••
II FUNCTION FOR HOTEL NAMF.

.
11••·······················
void hot_nam·c ()
{
settextstyle(4,0,S):
setcolor(WHITE);
outtextxy(200,3," TIME HOTEL");
Iine(200,50,440,50);

11••···························
// FUNCTION FOR MAIN MENU
n•••••••••••••••••••••••••••••
int .inmenu()
{
cleardevicc();
int c;
setfillstyle(7, I);
floodfill(0,0,4);
setfillstyle(7, 10);
bar(50,80,600,4 70);
rectangle( 50,80,600,4 70);
setfillstyle( I,7);
bar(57,87,593,463);
rectangle( 57,87 ,593 ,463 );
setcolor(9);
setfillstyle( 1,2); ·
bar(2 I 0, 140,410,238);
rectanglc(210, l40,410,l 58);
rectangle(210,140,410, 174);
rc.,-ctangle(2 I 0, 140,4 I0, 190);
rectangle(210,140,410,206);
rectangle(2 I 0, 140,410,222);
rectanglc(2 I 0, I 40,4 I 0,238);
sctcolor(WHJTE);
settcxtstyle(4,0,4);
outtextxy( 160,20,"HOTEL MANAGEMENT");
setcolor( 14 );
line( 163,60,515,60);
setcolor( 4 );
settextstyle( 1,0, I);
outtextxy(225,137," MAIN MENU");
outtextxy(210,l54," I. INFORMATION");
outtextxy(210, l70," 2. CUSTOMER DETAIL");
outtextxy(2 I 0, 186," 3. FOOD DETAIL");
outtcxtxy(2 l 0,202," 4. CUSTOMER BlLL ");
outtcxtxy(2 I 0,218," 5. EXIT");
setcolor(4);
settcxtstyle(7,0,2);

20 )r--- - ------ --
outtextxy(2 I 0,300,"ENTER CHOICE :- ");
fflush(stdin);
gotoxy(S3,20);
cin>>c;
return c;

II FUNCTION OF ENDING
u••••••••••••••••••••••••
void bye()

{ '

cleardevice();
setcolor( 12);
settextstyle( 1.0,S);
setbkcolor(BLUE);
outtextxy(70, 150,"THANKS FOR VlSlTING");
~tcolor( IO);
settel(tstyle( 1,0,8);
outtextxy( I 00,250,"PROJECT");
settextstyle( 1,0,3 );
outtextxy(l 50,450,"SHUlTING DOWN .. . .");
getch();
sctcolor( 12);
settextstyle( 1,0,5);
outtcxtxy(70, 150,"THANKS FOR VISJTlNG");
sctcolor( I 0);
settextstyle( 1,0,8);
outtcxtxy( I 00,250,"PROJ ECT");
settcxtstyle( 1,0,3 );
outtextxy(I 50,450, "SHUTTING DOWN .... ");

for(int iacO;i<I O;i++)


{
sound(IOOO•i);
setbkcolor(i);
nosound();

11•··· .. ••••••• ............................ .


// FUNCTION OF CHOICE FOR INFORMATION
11• .. ••••••••• .............................. .

void choice(int a)
{
switch(a)
{
case I:
{
information();
break;

case 2:
{

- - - ----1( 21 )r-----c-----
cust.cust_delllil():
break ;

case 3:
I
d.food_mcnu();
break;

c~c4 :
{
cust.cust_bill();
break;

ll•••••••••••••••••••••••••••
l! .FUNCTION FOR INFORMATION
ll*••••••••••••••••••••••••••
void information()
{
cleardevicc();
setfillstyle(7, 1};
nood fill (0,0,4 );
setfillsty le(7, 10};
bar{ 17,50,605.4 70);
rectangle( 17,50,605,470);
setfillstylc( I, 7);
bar(24,57,598,463);
rcctangle(24 ,57.598,463);
gotoxy(6,4};
setcolor(4};
getchO;
}
};

11••·····································,······
//THIS IS MAJN FUNCTION CALLING VARIOUS
II FUNCTIONS
11••··~·········································
void main()
{
clrscrO;
int gm=DETECT,gd;
initgraph(&gm,&gd, "c:\\turboc3\lbgi"};
setbkcolor(BLUE};
setcolor(RED);
for(in t i=0;i<450;i++)
{circlc(305 ,250,i);
dc:lay(3);
l
setcolor(GREEN);

22
settextstyle( 1,0, 11 );
· outtextxy(80, 150,"VINEETA");
getchO;
cleardevicc():
setbkcolor(BLUE);
setcolor(R£O);
for(i=O ;i<450;i++)
{circle(305,250,i);
dclay(3);
}
sctcolor(GREEN);
settextstylc(l ,0,9);
outtextxy(I00,0,"PRESENTS");
outtextxy(270, 120,"A");
outtextxy( l 00,240, "PROJECT");
outtextxy(250,360,"ON");
getchO;
clcardevico();
setbkcolor( 4);
setcolor(GREEN);

{ t:,,
scttcxtstylc( 1,0,i);
outtextxy(4o+i,140+i," TIME HOTEL");
sound{200•i);
delay(600);
nosoundO;
cleardevice();
l
outtextxy(46, l 46," TIME HOTEL");
getchQ;
control c;
// void acknowO
//{
II cleardevice();
sctbkcolor(BLACK);
_'.. sctfillstyle(7,1);
' lloodfill(0,0,4);
setfillstyle(7, l 0);
bar( 17.50,605,4 70);
rectangle( 17,50,605 ,470);
setfillstyle( I,7);
bar(24,57,598,463 ):
rectangle(24 ,5 7,598 ,463);
setcolor(S);
scnextstyle( 1,0,5);
outtcxtxy(85,5 ,"ACKNOWLEOGEMENT");
settextsty le( 1,0,3 );
setcolor(BLACK);
outtextxy(S0,60,"I wish to express my deep and heartiest");
outtextxy(40,90,"thanks to my sir :Mr. RAMESH Y ADAY whose");
outtextxy(40,120,"valueable adviee,guidence and helped me a ");
outtextxy( 40, 150,"lot in doing this project from conception to");
outtcxtxy(40, 180,"completion ");
outtextxy( l 00,21 0,"l am also very thankful to my parents ");

23

You might also like