Techtro: Skip To Content

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 54

Skip to content

TECHTRO
Be Unique

 Welcome
 NDA
 Blog
o Education
 Physics
 CHEMISTRY
 C++
 Maths
 OTHER
o Trending News
o Tech
o loot deals
 Privacy Policy
 About
 Contact
C++ program on hotel management
On 23 Jan 2017 By Neeraj KholiyaIn C++, Projects

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: TheRead () 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 SYSTEM Microsoft 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 opera
ting system.

DISK DRIVE CDROM devices.

PRINTING/EDITING DEVICES Default keyboard.

MONITOR Super VGA (800 x 6000) or high resolution. With 265 Colors.
/*

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

*******************

*** 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 LOKESH YADAV\n\n\t\t NAVEEN KUMAR YADAV


“;

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();
}

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: http://www.google.co.in
 http://www.tutorialspoint.com
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: TheRead () 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 SYSTEM Microsoft 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 opera
ting system.

DISK DRIVE CDROM devices.

PRINTING/EDITING DEVICES Default keyboard.

MONITOR Super VGA (800 x 6000) or high resolution. With 265 Colors.
/*

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

*******************

*** 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 LOKESH YADAV\n\n\t\t NAVEEN KUMAR YADAV


“;

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();

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: http://www.google.co.in
 http://www.tutorialspoint.com

Advertisement
Advertisements
Report this ad
Report this ad

Share this:

 Twitter
 Facebook
 Google

Related

Student Database Management System

In "C++"
CBSE class 12th result will be declare on 28 May, How to check? Read full...

In "Education"

CBSE Class XII Result date? And reason for delay?

In "Chemistry"

c+ project cbse class 12c++ program cbsec++ program cbse class 12.c++ programsc++
projectc++ project class 12c++ project class 12 cbsecbse c++ class 12 project

Post navigation
Previous

Mi Launches VR in India – VR Features

Next

physics project on laser sensitive alarm

Leave a Reply
Search for:

TechFun
TechFun
Advertisements
Report this ad

Latest post
 The basic trigonometry for NDA: 5 Feb 2018
 CBSE Class XII Result date? And reason for delay? 25 May 2017
 CBSE class 12th result will be declare on 28 May, How to check? Read full… 24
May 2017
 Mumbai Indian beats Rising Pune Supergaints and establishe new records tonight…
21 May 2017
 TravelKida App: Refer Friends and Get Free Trips To Goa or Manali 21 May 2017

Publisher
 adarshhhh

 anshrana

 Αηυbhαν Sιηgh

 OMi Shah

 Raaz

 Neeraj Kholiya

Follow Blog via Email


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 4,537 other followers


Social

Report this ad

You might also like