Академический Документы
Профессиональный Документы
Культура Документы
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();
: ";
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
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
cout<<"\n
cout<<"\n
# 2. INTRODUCTION TO HOTEL
cout<<"\n
#";
#";
#";
#";
cout<<"\n
# 3. ROOM BOOKING
#";
cout<<"\n
cout<<"\n
cout<<"\n
cout<<"\n
# 5. BILL
cout<<"\n
cout<<"\n
#";
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
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";
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
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 ";
10
";
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
";
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
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
cout<<"\n\t\t\t
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
";
";
";
cout<<"\n\t\t\t
2) HARD DRINKS";
cout<<"\n\t\t\t
cout<<"\n\t\t\t
cout<<"\n\t\t\t
5) ICE-CREAM ";
cout<<"\n\t\t\t
6) SHAKES ";
}
//*****************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**********************************************
***";
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);
\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