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

Index

1. INTRODUCTION.
2. SYSTEM
REQUIREMENTS.
3. HEADER FILES.
4. USER DEFINED
FUNCTIONS.
5. PROGRAM SOURCE
CODE.
6 . OUTPUT SCREEN SHOTS.
7. LIMITATIONS.
8. BIBLIOGRAPHY.
INTRODUCTION
HOTEL MANAGEMENT project in C++ is a simple console application built
without the use of graphics. This project Hotel Management help in managing the
record of the customer according to the name, day of arrival ,day of staying and
much more. In this project we tried to enter all details of customer and tried to
maintain all the possibility which may help the user to enter more record if he/she
requires.
1. Create record: This feature creates a new customer records. For this the
information to be provided are the date of arrival , no. of person, name, age,
address, nationality, days of staying and choice for AC or NON-AC .

2. Check status: this feature allow user to check the status of the total room
available, for AC or NON AC, cost of AC and NON AC.

3. To book a room: this feature is same as the above. This feature allow user
to book a room on the basics of the date of arrival ,no of person ,name ,age ,
address ,nationality ,days of staying and choice for AC or NON AC .

4. Delete Customer’s record: This feature deletes the record of a particular


customer; it first of all asks for the name of the customer whose record is to be
deleted.

5. Search customer’s record: In Hotel Management project in C++, this


feature is used to search the record of a particular customer. It first ask for the
customer’s name for the searching of records . upon successful searching, the
program displays the records of a particular customer ,but on the unsuccessful
searching it display the message “Name not present in the record”.

6. Read all the record: The Read () function in project in C++ has been used
for this feature. It basically shows the Room no, Name, Address, Nationality,
Date of arrival .
7. To know the room bill: This feature show the bill of a particular customer.
It basically ask the room no of the hotel in which ot show the record.

8. To short the record: This feature short all the customer record. It first ask
to short Room no wise ,means it short on the basis of room no. then Name wise
means it short on the basis of name, Nationality wise means it short on the
basis of Nationality, date wise means it short on the basis of date ,no of days
wise means it short on the basis of days, bill wise means it short on the basis of
bill .

9. To Exit: This feature allows the user to exit program. Ot basically terminate

the program.
REQUIREMENTS
PROCESSOR Pentium 233 MH or higher
processor Pentium 111 recommended.
OPERATING SYSTEMMicrosoft windows
98/7/8/HP/window HP recommended.
MEMORY 4 GB RAM (minimum), 128 MB
recommended.
DISK SPACE 120 MB including 115 MB of
available space on hard disk that contains
the operating system.
DISK DRIVE CDROM devices.
PRINTING/EDITING DEVICES Default
keyboard.
MONITOR Super VGA (800 x 6000) or high
resolution. With 265 Colors.
HEADER FILES

Iostream.h-for input output


manipulations.
Conio.h-for console input and
output.
Stdlib.h-for general utility function.
Stdio.h- for input and output
functions.
Fstream.h- for file handling.
Ctype.h-for charachter handling
functions.
String.h-for string functions.
Process.h-for macros and
declarations.
Dos.h-it contains the
interrupts,producing sound,date and
time functions.
USER DEFINED
FUNCTIONS
1. welcome()-to create welcome
page.
2. create()-to create the record.
3. intial()-to display the initial
status of rooms.
4. status()-to display the no of
rooms booked.
5. search()-to search specific
record.
6. modify()-to modify the record.
7. delete()-to delete the record.
CODING
/*

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*******************
*** HEADER FILES***
*******************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<fstream.h>
#include<ctype.h>
#include<dos.h>
#include<process.h>
#include<string.h>

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**********************
*** GLOBAL VARIABLE ***
**********************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
int ac=50;
int non_ac=50;
int no_of_room=100;

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*****************
*** STRUCTURE ***
*****************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
struct hotel
{
int day,year,month;
int no_of_person;
int no_of_room;
char name[30];
char nationality[20];
int ac;
int room_no;
int non_ac;
int no_of_day;
char address[20];
}h;

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***************
*** WELCOME ***
***************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void welcome()
{

cout<<"\n\n\n\n\n\n\n\t\t\t|*****************************|";
cout<<"\n\t\t\t !!!! PROJECT MADE BY !!!! \n";
cout<<"\n\t\t\t Mayank Kashyap\n\n\t\t Shriyash Shukla ";
cout<<"\n\t\t\t|*****************************|";

getch(); clrscr();
cout<<"\n\n\n\n\n\n\n\t\t\t*****************************";
cout<<"\n\t\t\t !!!!HOTEL MANAGEMENT!!!!\n";
cout<<"\t\t\t*****************************";
getch();
cout<<"\n\n\n\n\n\t\tPress any key to continue..................";
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** CREATE ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void create()
{
clrscr();
char ch;
ofstream fo("naveen.dat",ios::app);
cout<<"\t\t\nCREATING FILE";
cout<<"\nDate of Arrival: ";
cin>>h.day;
cout<<"\nMonth: ";
cin>>h.month;
cout<<"\nYear: ";
cin>>h.year;
cout<<"\nNo_of_person: ";
cin>>h.no_of_person;
cout<<"\nName: ";
gets(h.name);
cout<<"\nAddress: ";
gets(h.address);
cout<<"\nNationality: ";
gets(h.nationality);
if(no_of_room>0)
{
cout<<"\nEnter choice (a/A for ac & n/N for non_ac): ";
cin>>ch;
if(ch=='a'||ch=='A')
{
if(ac>0)
{

cout<<"\nENTER ROOM NO: ";


cin>>h.room_no;
ac=ac-1;
}
no_of_room=no_of_room-1;
cout<<"\nNow total room available: "<<no_of_room;
}
else
{
if(non_ac>0)
{

cout<<"\nENTER ROOM NO : ";


cin>>h.room_no;
non_ac=non_ac-1;
}
no_of_room=no_of_room-1;
cout<<"\nNow total room available: "<<no_of_room;
}
}
fo.write((char *)&h,sizeof(h));
fo.close();

}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** INTIAL ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void intial()
{
clrscr();
h.ac=50;
h.no_of_room=100;
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** STATUS ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void status()
{
clrscr();
ifstream fi("naveen.dat",ios::binary|ios::app|ios::in);
cout<<"\t\t\tSTATUS";
while(!fi.eof())
{
fi.read((char*)&h,sizeof(h));
}
fi.close();
cout<<"\n\n\n\n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
cout<<"\n ~ ~";
cout<<"\n ~ No of AC room : "<<ac<<" ~";
cout<<"\n ~ No. of NON - AC room : "<<non_ac<<" ~";
cout<<"\n ~ No. of room available in the Hotel : "<<no_of_room<<"
~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**** READ ****
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void read()
{
clrscr();
int y=12;
ifstream fi("naveen.dat",ios::binary|ios::app|ios::in);
gotoxy(32,5);
cprintf("PEOPLE STAYING IN THE HOTEL");
gotoxy(6,6);

cprintf("=============================================================
===========");
textcolor(YELLOW);
gotoxy(10,7);
cprintf("ROOM NO.");
gotoxy(25,7);
cprintf("NAME");
gotoxy(35,7);
cprintf("ADDRESS");
gotoxy(50,7);
cprintf("NATIONALITY");
gotoxy(65,7);
cprintf("DATE");
gotoxy(6,9);

cprintf("=============================================================
===========");
while(fi.read((char*)&h,sizeof(h)))
{
gotoxy(10,y);
cout<<h.room_no;
gotoxy(25,y);
cout<<h.name;
gotoxy(35,y);
cout<<h.address;
gotoxy(50,y);
cout<<h.nationality;
gotoxy(65,y);
cout<<h.day<<"/"<<h.month<<"/"<<h.year;
cout<<endl;
y=y+1;
getch();
}
fi.close();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** SEARCH ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void search()
{
clrscr();
int f=0;
char n[20];
ifstream fi("naveen.dat",ios::binary|ios::app|ios::in);
cout<<"\nEnter name to whose record to be search: ";
gets(n);
while(fi.read((char*)&h,sizeof(h)))
{
if(strcmp(n,h.name)==0)
{
cout<<"\n\t\tRecord FOUND";
cout<<"\n\n";
cout<<"\t\tDetails of record"<<endl;
cout<<"\n\tName: "<<h.name;
cout<<"\n\tNationality: "<<h.nationality;
cout<<"\n\tDate of Arrival:"<<h.day<<'-'<<h.month<<'-'<<h.year;
cout<<"\n\tNo. of person:"<<h.no_of_person;
f=1;
break;
}
}
if(f==0)
cout<<"Record DOES NOT exist";
fi.close();
getch();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** MODIFY ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

void modify()
{
clrscr();
int a=0;
char n[20];
fstream fo;
fo.open("naveen.dat",ios::out|ios::in);
cout<<"\t\tMODIFY";
cout<<"\nEnter name of person whose record is to be modify: ";
gets(n);
while(fo.read((char*)&h,sizeof(h)))
{
if(strcmp(n,h.name)==0)
{
long p=fo.tellp()-sizeof(h);
cout<<"\n\tEnter new detail";
cout<<"\nEnter no_of_person: ";
cin>>h.no_of_person;
cout<<"\nEnter Name: ";
gets(h.name);
cout<<"\nEnter Address: ";
gets(h.address);
cout<<"\nEnter Nationality: ";
gets(h.nationality);
a=1;
fo.seekp(p,ios::beg);
fo.write((char*)&h,sizeof(h));
break;
}
}
if(a==0)
cout<<"EMPTY RECORD";
fo.close();
getch();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
*** DELETE ***
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void delet()
{
clrscr();
int f=0;
char c;
char n[30];
fstream fi;
fi.open("naveen.dat",ios::in);
fstream fo;
fo.open("new.dat",ios::out);
clrscr();
cout<<"\t\t\tDELETE";
cout<<"\nEnter name of person whose record is to be deleted : ";
gets(n);
while(fi.read((char*)&h,sizeof(h)))
{
if(strcmp(n,h.name)==0)
{
f=1;
cout<<"\nDetail of person: ";
cout<<h.name<<'\n';
cout<<h.nationality<<'\n';
cout<<h.address<<'\n';
cout<<"\nDate of Arrival:"<<h.day<<"/"<<h.month<<"/" <<h.year;
}
else
fo.write((char*)&h,sizeof(h));
}
fi.close();
fo.close();
if(f==0)
cout<<"Record DOES NOT exist";

remove("naveen.dat");
rename("new.dat","naveen.dat");
getch();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
************
*** MAIN ***
************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void main()
{
clrscr();
welcome();
int c;
char ch;
do
{
clrscr();
cout<<"\t\t";
for(int i=0;i<20;i++)
{

cout<<'-';
}
cout<<"\n\n\t\tMAIN MENU\n\n";
cout<<"\t\t";
for(i=0;i<20;i++)
{
cout<<'-';
}
cout<<"\n\n\n\t\t";
for(i=0;i<40;i++)
{

cout<<'-';
}
cout<<"\n\n\t\tPress:(1) to Create...."
<<"\n\t\t (2) to Check status...."
<<"\n\t\t (3) to Delete a record...."
<<"\n\t\t (4) to Modify a record...."
<<"\n\t\t (5) to Search a record...."
<<"\n\t\t (6) to Read all the records...."
<<"\n\t\t (7) to Exit....";
cout<<"\n\n\n\t\t";
for(i=0;i<40;i++)
{

cout<<'-';
}
textcolor(14);
cout<<"\n\n\n\t\t\t\tEnter your choice: ";
cin>>c;
switch(c)
{
case 1:
create();
break;
case 2:
intial();
status();
break;

case 3:
delet();
break;
case 4:
modify();
break;
case 5:
search();
break;
case 6:
read();
break;
case 7:
clrscr();
cout<<"\n\n\n";
cout<<"\t\t\t\tPLEASE WAIT..... ";
cout<<"\n\n\n";
cout<<"\t\t\t\t EXITING";
delay(1500);
exit(0);

default:
clrscr();
cout<<"\n\n\t\t\t\t!!Invalid choice!!";
cout<<"\n\n\n";
cout<<"\t\t\t\t EXITING";
delay(2000);
exit(0);

cout<<"\n\nWant to continue(Y/N)...";
cin>>ch;
}while(ch=='y'||ch=='Y');
getch();
}
OUTPUTS
Bibliography
 Sumita arora class 12
 Move fast with C++ class 12
 Arihant of C++ class 12
 Website: www.google.co.in
 http://www.tutorialspoint.com