NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <iostream>
#include <conio.h>
#include <fstream>
#include <stdio.h>
#include <dos.h>
using namespace std;
class hotel
{
int room_no;
char name[30];
char address[50];
char phone[10];
public:
void main_menu();//to desplay the main menu
void add(); //to book a room
void display();//to display the costumer record
void rooms();//to desplay allowed room
void edit();//to edit the costumer record
void check();//to check room status
void modify();//to modify the record
void delete_rec(int);//to delete the record
};
void hotel::main_menu()
{
int choise;
while(choise!=5)
{
cout<<"ntttt"*******************";
cout<<"ntttt"* MAIN MENU *";
cout<<"ntttt"*******************";
cout<<"nttttt1.book a room";
cout<<"nttttt2.costumer record";// "/n=endl" /t-----sposton textin ne mes->
cout<<"nttttt3.rooms allowed";
cout<<"nttttt4.edit record";
cout<<"nttttt5.exit";
cout<<"ntttttEnter your choise: ";
cin>>choice;
switch(choice){
case 1: add();
break;
case 2: display();
break;
case 3: rooms();
break;
case 4: edit();
break;
case 5:break;
default:
{

cout<<"nntttWrong choice!!!";
cout<<"ntttPress any key to continue!!";
getch();
}
}
}
}
void hotel::add(){
int r,flag;
ofstream fout ("record.dat",ios::app);
cout<<"n Enter costumer details";
cout<<"n***********************";
cout<<"nn room no:";
cin>>r;
flag=check(r);
if(flag)
cout<<"n sorry..!!!Room is already booked";
else{
room_no=r;
cout<<"Name:";
gets(name); //gets(name)=cin>>
cout<<"Address:";
gets(address);
cout<<"Phone no:";
gets(phone);
fout.write((char*)this,sizeof(hotel));//shkruan ne file
cout<<"n Room is booked!!!";
}
cout<<"n Pres any key to continue!!";
getch();
fout.close();
}
void hote::display(){
ifstream fin("record.dat",ios::in);
int r,flag;
cout<<"nEnter room no:";
cin>>r;
while(!fin.eof()){
fin.read((char*)this,sizeof(hotel));
if (room_no==r)
{
cout<<"n costumer details";
cout<<"n ****************";
cout<<"nn Room no:"<<room_no;
cout<<"n name:"<<name;
cout<<"n address:"<<address;
cout<<"n phone no"<<phone;
flag=1;
break;
}
}
if(flag==0)
cout<<"n Sorry room no. not found or vacant!!";
cout<<"nn Press any key to continue!!";
getch();
fin.close();
}
void hotel::rooms(){
ifstream fin("record.dat",ios::in);
cout<<"ntttList of rooms allotted";
cout<<"nttt**********************";
cout<<"nn room no.tnamettaddressttphone no.n";
while(!fin.eof())//end of file
{
fin.read((char*)this,sizeof(hotel));
cout<<"nn"<<room_no<<"tt"<<name;
cout<<"tt"<<address<<"tt"<<phone;
}
cout<<"nnntttPress any key to continue!!";
getch();
fin.close();
}
void hotel::edit()
{
int choice,r;
cout<<n "EDIT MENU";
cout<<"n *********";
cout<<"nn 1.Modify costumer record";
cout<<"n 2.Delete costumer record";
cout<<"n Enter your choice:";
cin>>choice;

cout<<"n Enter room no:";
cin>>r;
switch(choice){
case 1:modify(r);
break;
case 2:delete_rec(r);
break;
default:cout<<"n Wrong choice!!";
}
cout<<"n Press any key to continue!!!";
getch();
}
int hotel::check(int r)
{
int flag=0;
ifstream fin ("record.dat",ios::in);
while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
if (room_no==r)
{
flag=1;
break;
}
}
fin.close();
return(flag);
}
void hotel::modify(int r){
long pos,flag=0;
fstream file("record.dat",ios::Init |ios::out|ios::binary);
while(!file.eof())
{
pos=file.tellg();
file.read((char*)this,sizeof(hotel));
if(room_no==r)
{
cout<<"n Enter new details";
cout<<"n *****************";
cout<<"n Name:";
gets(name);
cout<<"n address:";
gets(address);
cout<<"n phone no:";
gets(phone_no);
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.