Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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 .
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.
DISK SPACE 120 MB including 115 MB of available space on hard disk that
contains the operating system.
MONITOR Super VGA (800 x 6000) or high resolution. With 265 Colors.
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*******************
*******************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#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>
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**********************
**********************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
int ac=50;
int non_ac=50;
int no_of_room=100;
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*****************
*****************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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;
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***************
***************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void welcome()
cout<<"\n\n\n\n\n\n\n\t\t\t|*****************************|";
cout<<"\n\t\t\t|*****************************|";
getch(); clrscr();
cout<<"\n\n\n\n\n\n\n\t\t\t*****************************";
cout<<"\t\t\t*****************************";
getch();
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void create()
clrscr();
char ch;
ofstream fo("naveen.dat",ios::app);
cout<<"\t\t\nCREATING FILE";
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)
cin>>ch;
if(ch=='a'||ch=='A')
if(ac>0)
cin>>h.room_no;
ac=ac-1;
no_of_room=no_of_room-1;
else
if(non_ac>0)
cin>>h.room_no;
non_ac=non_ac-1;
no_of_room=no_of_room-1;
fo.write((char *)&h,sizeof(h));
fo.close();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void intial()
clrscr();
h.ac=50;
h.no_of_room=100;
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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 ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n ~ ~";
cout<<"\n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void read()
clrscr();
int y=12;
ifstream fi("naveen.dat",ios::binary|ios::app|ios::in);
gotoxy(32,5);
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();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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)
fi.close();
getch();
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
void modify()
clrscr();
int a=0;
char n[20];
fstream fo;
fo.open("naveen.dat",ios::out|ios::in);
cout<<"\t\tMODIFY";
gets(n);
while(fo.read((char*)&h,sizeof(h)))
if(strcmp(n,h.name)==0)
long p=fo.tellp()-sizeof(h);
cin>>h.no_of_person;
gets(h.name);
gets(h.address);
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();
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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";
gets(n);
while(fi.read((char*)&h,sizeof(h)))
if(strcmp(n,h.name)==0)
f=1;
cout<<h.nationality<<'\n';
cout<<h.address<<'\n';
else
fo.write((char*)&h,sizeof(h));
fi.close();
fo.close();
if(f==0)
remove("naveen.dat");
rename("new.dat","naveen.dat");
getch();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
************
************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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...."
cout<<"\n\n\n\t\t";
for(i=0;i<40;i++)
cout<<'-';
textcolor(14);
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<<"\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();
}
WELCOME SCREEN
MAIN MENU SCREEN
CREATE SCREEN
STATUS SREEN
BOOKING SCREEN
DELEATING SREEN
MODIFING SCREEN
SEARCHING SCREEN
SHORTING SCREEN
BILL SCREEN
Limitations
Does not support mouse.
It is platform dependent (works in windows and not in Linux).
Output on screen changes with change in resolution.
If some string is gives as input i.e. in place where integer should have
been input, the program crashes and data file gets spoiled.
The program as such cannot be used as a software but after some
modifications it may be used as a full fledge software.
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