Techtro: Skip To Content
Techtro: Skip To Content
Techtro: 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
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
DISK SPACE
120 MB including 115 MB of available space on hard disk that contains the opera
ting 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”;
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)
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)
cout<<“\nENTER ROOM NO : “;
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);
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);
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();
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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<<“\nDetail of person: “;
cout<<h.name<<‘\n’;
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<<“\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
CREATE SCREEN
STATUS SREEN
BOOKING SCREEN
DELEATING SREEN
MODIFING SCREEN
SEARCHING SCREEN
SHORTING SCREEN
BILL SCREEN
Limitations
Bibliography
1. INTRODUCTION
2. SYSTEM REQUIREMENTS
3. HEADER FILES
4. USER DEFINED FUNCTIONS
5. PROGRAM SOURCE CODE
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
DISK SPACE
120 MB including 115 MB of available space on hard disk that contains the opera
ting 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”;
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)
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)
cout<<“\nENTER ROOM NO : “;
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);
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);
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();
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**************
**************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
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<<“\nDetail of person: “;
cout<<h.name<<‘\n’;
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….”
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<<“\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
Advertisement
Advertisements
Report this ad
Report this ad
Share this:
Twitter
Facebook
Google
Related
In "C++"
CBSE class 12th result will be declare on 28 May, How to check? Read full...
In "Education"
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
Next
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
Report this ad