Вы находитесь на странице: 1из 31

#include<stdio.

h>
#include<conio.h>
#include<fstream.h>
#include<process.h>
#include<iomanip.h>

void reco_whole();
void acdeluxe();
void ac();
void deluxe();
int menu(int);
void intro1();
void intro2();
void deletion();
void booking();
void restbar();
void bill();

//CLASS FOR KEEPING THE RECORDS OF THE


CUSTOMER
class room
{
private:
char name[20];
int room_no;
char add[25];
int days;
int amount;
public:
void getdata()
{
clrscr();
cout<<"\n\n\t\t\tEnter Detail of the Customer";
cout<<"\n\t\t\t_____________________________\n";
cout<<"\n\n ENTER THE ROOM No. : ";
cin>>room_no;
2

cout<<"\n ENTER NAME

: ";

gets(name);
cout<<"\n ENTER ADDRESS

: ";

gets(add);
cout<<"\n ENTER NO. OF DAYS FOR BOOKING : ";
cin>>days;
}
void putdata()
{
cout<<endl<<setw(5)<<room_no<<setw(21)<<name<<setw(26)<
<add<<setw(4)<<'\t'<<'\t'<<days;
}
int existrno(int delno)
{
int existd=0;
if (delno==room_no)
existd=1;
return existd;
}
3

};
void main()
{
clrscr();
int i;
int number;
gotoxy(10,10);
puts("*********************** W E L C O M E
************************* ");
gotoxy(16,16);
puts("H O T E L M A N A G E M E N T S O F T W A R E");
gotoxy(38,22);
puts(" D E V E L O P E D B Y : ");
gotoxy(38,26);
puts("

");

gotoxy(38,28);
puts(" XII - A");
gotoxy(38,30);
4

puts(" B.B.L. PUBLIC SCHOOL");


gotoxy(38,32);
puts(" BAREILLY");
gotoxy(38,40);
puts(" *** PRESS ANY KEY TO CONTINUE ***");
getch();
int num;
num=menu(number);
do
{
switch(num)
{
case 1: intro1();
num=menu(number);
break;
case 2: intro2();
num=menu(number);
break;
5

case 3: booking();
num=menu(number);
break;
case 4: restbar();
getch();
num=menu(number);
break;
case 5: bill();
num=menu(number);
break;
case 6: reco_whole();
getch();
num=menu(number);
break;
case 7: deletion();
getch();
num=menu(number);
break;
6

case 8: exit(0);
default: menu(number);
}
}
while(num!=0 &&num<=8);
}
int menu(int number)
{
clrscr();
cout<<"\n\n\n MAIN MENU \n\n ";
cout<<"\n";
cout<<"\n
##################################
##################";
cout<<"\n

cout<<"\n

# 1. INTRODUCTION TO SOFTWARE #";

cout<<"\n

cout<<"\n

# 2. INTRODUCTION TO HOTEL

cout<<"\n

#";

#";

#";

#";

cout<<"\n

# 3. ROOM BOOKING

#";

cout<<"\n

cout<<"\n

# 4. BAR AND RESTAURANT

cout<<"\n

cout<<"\n

# 5. BILL

cout<<"\n

cout<<"\n
#";

# 6. DISPLAY TOURIST INFORMATION

cout<<"\n

cout<<"\n

# 7. DELETE

cout<<"\n

cout<<"\n

# 8. EXIT

cout<<"\n

#";
#";

#";
#";
#";

#";
#";
#";
#";
#";

cout<<"\n
##################################
##################";
cout<<"\n ";
cout<<"\n\n\n
cin>>number;
8

ENTER YOUR CHOICE : ";

clrscr();
return(number);
}
//**********************INTRODUCTION TO THE
SOFTWARE************************
void intro1()
{
clrscr();
cout<<"\n

INTRODUCTION

";

cout<<"\n
----------------------cout<<"\n THIS IS A SOFTWARE PACKAGE ON
HOTEL MANAGEMENT. ";
cout<<"\n

";

cout<<"\n THIS SOFTWARE HAS BEEN DEVELOPED


KEEPING IN MIND ";
cout<<"\n THE PROBLEM FACED BY THE PEOPLE
WORKING IN HOTELS ";
cout<<"\n LIKE RECEPTIONIST ETC. DOING ALL THE
PAPER WORK ";
cout<<"\n AGAIN AND AGAIN. ";
9

cout<<"\n";
cout<<"\n WE HAVE TRIED OUR BEST TO COVER
MOSTLY ALL THE ";
cout<<"\n PROBLEMS IN MANAGING A HOTEL. WE
HOPE THAT THIS ";
cout<<"\n SOFTWARE WILL MEET THE
REQUIREMENT OF THE USER. ";
cout<<"\n\n\n

PRESS ANY KEY TO CONTINUE..... ";

getch();
clrscr();
}
//*******************************introduction to
hotel********************
void intro2()
{
cout<<"\n\n\n\t W E L C O M E

TO

H O T E L ";

cout<<"\n\t --------------------------------------- ";


cout<<"\n

10

";

cout<<"\n WELCOME TO HOTEL SENORA .WE HAVE


INCLUDED THREE TYPES OF ROOM IN OUR HOTEL.";
cout<<"\n WE HAVE ALSO INCLUDED MANY
FACILITES IN OUR HOTEL FOR THE CONVENEINCE
FOR";
cout<<"\n OUR GUESTS. ";
cout<<"\n\n\n
WE HAVE TOTAL 300 ROOMS IN OUR
HOTEL.THE LIST OF ROOMS THAT WE HAVE ARE";
cout<<"\n AS UNDER:- ";
cout<<"\n\n\n ";
cout<<"\n TYPES OF ROOM
CHARGES(per day) ";

TOTAL NO. OF ROOMS

cout<<"\n ************************************
******************* ";
cout<<"\n ";
cout<<"\n

AC

100

4000/-

cout<<"\n
cout<<"\n

";
";

AC_DELUXE

50

DELUXE

150

5000/-

";

cout<<"\n "
cout<<"\n
11

2000/-

";

cout<<"\n ";
cout<<"\n\n\n\n\n THE LIST OF FACILITIES THAT
WE OFFER TO OUR GUESTS ARE AS UNDER:- ";
cout<<"\n\n\n ";
cout<<"\n\n 1. ROOM SERVICES

(10% extra charges) ";

cout<<"\n\n 2. RESTURENT AND BAR ";


cout<<"\n\n 3. TAXI

(Rs.150/- per hour)

cout<<"\n\n 4. SWIMMING POOL


18:00 pm) ";
cout<<"\n\n 5. STEAM BATH

";

(Open from 06:00 am to

(250 Rs. per hour) ";

cout<<"\n\n\n PRESS ANY KEY TO CONTINUE.....";


getch();
clrscr();
}
//*************************** BOOKING FOR THE
ROOMS**************************
void booking()
{
clrscr();
12

int i;
gotoxy(32,5);
cout<<".\n

TYPES OF ROOMS

";

~~~~~~~~~~~~~~~~

";

gotoxy(32,6);
cout<<"\n
cout<<"\n" ;
gotoxy(10,10);
cout<<"\n

1. AC ROOM";

cout<<"\n" ;
cout<<"\n

2. AC-DELUXE ROOM";

cout<<"\n" ;
cout<<"\n

3. DELUXE ROOM";

cout<<"\n" ;
cout<<"\n" ;
cout<<"\n" ;
cout<<"\n";
cout<<"\n ENTER YOUR CHOICE (1,2,3): ";
cin>>i;
13

if(i==1)
ac( ) ;
if(i==2)
acdeluxe( ) ;
if(i==3)
deluxe();
}
void acdeluxe()
{
clrscr();
room ad;
ofstream out;
out.open("xyz.dat",ios::app);
char a;
do
{
ad.getdata();
out.write((char*)&ad,sizeof(ad));
14

cout<<"\n ANY MORE.......(y/n)";


cin>>a;
}
while(a=='y'||a=='Y');
out.close();
}
void ac()
{
clrscr();
room ad;
ofstream out;
out.open("xyz.dat",ios::app);
char a;
do
{
ad.getdata();
out.write((char*)& ad, sizeof(ad));
cout<<"\n ANY MORE......... (y/n)" ;
15

cin>>a;
}
while(a=='y'||a=='Y');
out.close( );
}
void deluxe( )
}
clrscr( );
room ad;
ofstream out;
out.open ( "xyz.dat" , ios::app ) ;
char a;
do
{
ad.getdata( );
out.write ((char*)&ad,sizeof (ad)) ;
cout<<"\n ANY MORE......(y/n)";
cin>>a;
16

}
while(a=='y'||a=='Y');
out.close();
}
//*********************** RESTAURANT &
BAR***********************
void restbar( )
{
clrscr();
int i;
gotoxy(28,7);
cout<<" ##########################";
gotoxy(28,8);
cout<<" BAR AND RESTAURANT ";
gotoxy(28,9);
cout<<" ##########################\n\n";
cout<<"\n\n\t\t\t ------------------------------";
cout<<"\n\t\t\t
17

FOOD INFORMATION";

cout<<"\n\t\t\t ------------------------------\n\n";
cout<<"\n\t\t\t

1) FAST FOOD ";

cout<<"\n\t\t\t

2) SOUTH INDIAN ";

cout<<"\n\t\t\t

3) CHINESE

cout<<"\n\t\t\t

4) SOUPS

cout<<"\n\t\t\t

5) NON VEG

cout<<"\n\t\t\t

6) SENORA SPECIAL ";

";
";
";

cout<<"\n\n\n\n\t\t\t ------------------------------- ";


cout<<"\n\t\t\t

BEVERAGES AND DESERTS ";

cout<<"\n\t\t\t ------------------------------- ";


cout<<"\n\n";
cout<<"\n\t\t\t

1) SOFT DRINKS ";

cout<<"\n\t\t\t

2) HARD DRINKS";

cout<<"\n\t\t\t

3) FRUIT JUICES ";

cout<<"\n\t\t\t

4) VEGETABLE JUICES ";

cout<<"\n\t\t\t

5) ICE-CREAM ";

cout<<"\n\t\t\t

6) SHAKES ";

cout<<"\n\n\n\t\t\t PRESS ANY KEY TO CONTINUE.....";


18

}
//*****************STARTING OF THE PROCEDURE OF
BILL GENERATION*************
void bill()
{
fstream bill;
bill.open("bill.dat",ios::out);
clrscr();
int r, n, nod=0, exfa, bill_exfa1=300, bill_exfa2, bill_exfa3,
bill_exfa4;
double bill_exfa=0;
double bill_room,amount=0;
const double c1=4000;
const double c2=5000;
const double c3=2000;
cout<<"\n*********************************";
cout<<"\n

CHARGES OF ROOM

cout<<"\n*********************************";
cout<<endl<<"Enter the advance money,if any..";
19

";

cin>>amount;
cout<<"\n The code of the type of room is given as follows:";
cout<<"\n AC -> 1";
cout<<"\n ACDELUXE -> 2";
cout<<"\n DELUXE -> 3";
cout<<"\n Enter the type of room :";
cin>>r;
cout<<"\n Enter no. of rooms :";
cin>>n;
cout<<"\n Enter no. of days :";
cin>>nod;
if (r==1)
bill_room=c1*nod;
if (r==2)
bill_room=c2*nod;
if(r==3)
bill_room=c3*nod;
cout<<"\n*****************************************";
20

cout<<"\n TOTAL BILL OF THE ROOM IS:"<<(bill_roomamount);


cout<<"\n******************************************";
cout<<"\n PRESS ANY KEY TO CONTINUE....";
getch();
clrscr();
cout<<"\n*********************************************";
cout<<"\nEXTRA FACILITIES AVAILABLE AT HOTEL
SENORA:";
cout<<"\n*********************************************";
cout<<endl;
cout<<endl<<"CHOICE 1: ROOM-SERVICES.";
cout<<endl<<"CHOICE 2: TAXI.";
cout<<endl<<"CHOICE 3: TOURIST-BUS.";
cout<<endl<<"CHOICE 4: SWIMMING-POOL.";
cout<<endl<<"CHOICE 5: LIBRARY.";
cout<<endl<<"CHOICE 6: STEAM-BATH.";
cout<<endl;
cout<<"\n Room service:";
21

cout<<"\n Room service is:"<<bill_exfa1<<endl;


cout<<"\n Taxi service:";
cout<<"\nEnter number of hours the taxi is needed for:";
int hours;
cin>>hours;
bill_exfa2=150*hours;
cout<<"\n Taxi service is:"<<bill_exfa2<<endl;
cout<<"\n Tourist bus:";
cout<<"\n Enter number of hours:";
cin>>hours;
bill_exfa3=300*hours;
cout<<"\n Tourist bus service is:"<<bill_exfa3<<endl;
cout<<"\n Steam bath:";
cout<<"\n Enter number of hours:";
cin>>hours;
bill_exfa4=250*hours;
cout<<"\n Steam bath service is:"<<bill_exfa4<<endl;
bill_exfa=bill_exfa1+bill_exfa2+bill_exfa3+bill_exfa4;
22

cout<<"\n**********************************************
***";
cout<<"\n TOTAL BILL FOR EXTRA FACILITIES
IS:"<<bill_exfa;
cout<<"\n*********************************************";
cout<<"\n PRESS ANY KEY TO CONTINUE.....";
getch();
clrscr();
double bill_rest;
const double ff=150 ;
const double si=100 ;
const double ssp=200 ;
cout<<"\n***********************************";
cout<<"\n CHARGES FOR RESTAURANT AND BAR ";
cout<<"\n************************************";
cout<<"\n Code for the type of food chosen:";
cout<<"\n Fast food->1";
cout<<"\n South Indian->2";
23

cout<<"\n Soup->3";
cout<<"\n Non-veg->4";
cout<<"\n Hotel special->5";
cout<<"\n Enter no. of plates of fast food:";
cin>>n;
int c11=n*ff;
cout<<"\n Enter no. of plates of s.Indian food:";
cin>>n;
int c12=n*si;
cout<<"\n Enter no. of plates of hotel special:";
cin>>n;
int c13=n*ssp;
bill_rest=c11+c12+c13;
cout<<"\n*************************************";
cout<<"\n THE TOTAL AMOUNT FOR RESTURANT
IS:"<<bill_rest;
cout<<"\n*************************************";
cout<<"\n PRESS ANY KEY TO CONTINUE....";
24

getch();
clrscr();
int bill1=(bill_room-amount)+bill_exfa+bill_rest;
gotoxy(22,5);
cout<<"
##################################
#################";
gotoxy(27,6);
cout<<" H O T E L

B I L L ";

gotoxy(22,7);
cout<<"
##################################
#################";
cout<<"\n";
cout<<"\n**********************************************
*****";
cout<<"\n

ITEM

CHARGES";

cout<<"\n**********************************************
*****";
cout<<"\n BILL OF ROOM
25

\t"<<(bill_room-amount);

cout<<"\n BILL OF EXTRA FACILITIES


cout<<"\n BILL OF RESTAURANT

\t"<<bill_exfa;

\t"<<bill_rest;

cout<<"\n**********************************************
*****";
cout<<"\n THE TOTAL AMOUNT IS \t"<<bill1;
double a1=(bill1)*.30;
cout<<"\n TOTAL TAXES
\t"<<a1;
cout<<"\n**********************************************
******";
double tax=(bill1)+a1;
cout<<"\n THE TOTAL AMOUNT AFTER TAXES
\t"<<tax;
cout<<"\n**********************************************
*****";
cout<<"\n PRESS ANY KEY TO CONTINUE....";
getch();
}
void reco_whole()
{
clrscr();
26

room ad;
ifstream origin("xyz.dat");
int norec,end,end1;
origin.seekg(0,ios::end);
norec=origin.tellg()/sizeof(ad);
end=0;
cout<<"*****************************************\n";
cout<<"Name of Database :-XYZ.DAT REC:"<<norec<<endl;
cout<<"*****************************************";
cout<<"\nTHE TOURISTS DETAILS AND LISTING";
cout<<"\nROOM
No."<<'\t'<<'\t'<<"NAME"<<'\t'<<'\t'<<'\t'<<"ADDRESS"<<
'\t'<<'\t'<<"NO_OF_DAYS";
origin.seekg(0,ios::beg);
while(origin)
{
origin.read((char*)&ad,sizeof(ad));
end++;
ad.putdata();
27

if (end==norec)
break;
}
origin.close();
cout<<"\n \n PRESS ANY KEY TO CONTINUE.....";
}
void deletion( )
{
room delrom;
clrscr();
ifstream origin1("xyz.dat",ios::in);
origin1.seekg(0,ios::beg);
ofstream temp("temp.txt",ios::out);
unsigned long int temp_no=0;
cout<<"Enter room no. to be deleted : ";
cin>>temp_no;
int norec,end,end1;
origin1.seekg(0,ios::end);
28

norec=origin1.tellg()/sizeof(delrom);
int temrec,foundr=0;
end=0;
origin1.seekg(0,ios::beg);
cout<<"The total number of records are"<<norec<<endl;
for(int x=0;x<norec;x++)
{
origin1.read((char*)&delrom,sizeof(delrom));
end1=delrom.existrno(temp_no);
if(end1)
{
foundr+=1;
cout<<"DELETED";
}
else
{
temp.write((char*)&delrom,sizeof (delrom));
end++;
29

}
}
cout<<"\nTotal Number of records written to temp are
"<<end<<endl;
getch();
origin1.close();
temp.close();
ofstream origin2("xyz.dat",ios::trunc);
origin1.close();
ofstream origin3("xyz.dat",ios::out);
ifstream temp1("temp.txt",ios::in);
temp1.seekg(0,ios::beg);
int tempno=0;
temp1.seekg(0,ios::end);
tempno=temp1.tellg()/sizeof(delrom);
temp1.seekg(0,ios::beg);
cout<<"Total records in Temp file "<<tempno<<endl;
for(int y=0;y<tempno;y++)
30

{
temp1.read((char*)&delrom,sizeof delrom);
delrom.putdata();
cout<<endl;
origin3.write((char*)&delrom,sizeof delrom);
}
origin3.close();
temp1.close();
ofstream temp2("temp.txt",ios::trunc);
temp2.seekp(0,ios::beg);
temp2.close();
}

31

Вам также может понравиться