Hack Your Mind Right Now....!

  • Home
  • Android
  • C Language
  • Facebook Hacking
    • 20 FB Tricks
    • Animation in FB
  • DeadlyHacker

C++ Hotel Management Project

Posted by Unknown at 2:07 PM
C++ Hotel Management Project

C++ Hotel Management Project

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
#include<dos.h>

class hotel
{
int room_no;
char name[30];
char address[50];
char phone[10];

public:
void main_menu(); //to dispay the main menu
void add();         //to book a room
void display();          //to display the customer record
void rooms(); //to display alloted rooms
void edit();         //to edit the customer record
int check(int); //to check room status
void modify(int);         //to modify the record
void delete_rec(int); //to delete the record
};

void hotel::main_menu()
{
int choice;
while(choice!=5)
{
clrscr();
cout<<"\n\t\t\t\t*************";
cout<<"\n\t\t\t\t* MAIN MENU *";
cout<<"\n\t\t\t\t*************";
cout<<"\n\n\n\t\t\t1.Book A Room";
cout<<"\n\t\t\t2.Customer Record";
cout<<"\n\t\t\t3.Rooms Allotted";
cout<<"\n\t\t\t4.Edit Record";
cout<<"\n\t\t\t5.Exit";
cout<<"\n\n\t\t\tEnter Your Choice: ";
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<<"\n\n\t\t\tWrong choice.....!!!";
cout<<"\n\t\t\tPress any key to continue....!!";
getch();
}
}
}
}

void hotel::add()
{
clrscr();
int r,flag;
ofstream fout("Record.dat",ios::app);

cout<<"\n Enter Customer Detalis";
cout<<"\n ----------------------";
cout<<"\n\n Room no: ";
cin>>r;
flag=check(r);

if(flag)
cout<<"\n Sorry..!!!Room is already booked";

else
{
room_no=r;
cout<<" Name: ";
gets(name);
cout<<" Address: ";
gets(address);
cout<<" Phone No: ";
gets(phone);
fout.write((char*)this,sizeof(hotel));
cout<<"\n Room is booked...!!!";
}

cout<<"\n Press any key to continue.....!!";
getch();
fout.close();
}

void hotel::display()
{
clrscr();
ifstream fin("Record.dat",ios::in);
int r,flag;
cout<<"\n Enter room no: ";
cin>>r;

while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
if(room_no==r)
{
clrscr();
cout<<"\n Cusromer Details";
cout<<"\n ----------------";
cout<<"\n\n 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<<"\n\n Press any key to continue....!!";
getch();
fin.close();

}


void hotel::rooms()
{
clrscr();
ifstream fin("Record.dat",ios::in);
cout<<"\n\t\t\t    List Of Rooms Allotted";
cout<<"\n\t\t\t    ----------------------";
cout<<"\n\n Room No.\tName\t\tAddress\t\t\t\tPhone No.\n";

while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
cout<<"\n\n "<<room_no<<"\t\t"<<name;
cout<<"\t\t"<<address<<"\t\t"<<phone;
}
cout<<"\n\n\n\t\t\tPress any key to continue.....!!";
getch();
fin.close();
}

void hotel::edit()
{
clrscr();
int choice,r;

cout<<"\n EDIT MENU";
cout<<"\n ---------";
cout<<"\n\n 1.Modify Customer Record";
cout<<"\n 2.Delete Customer Record";

cout<<"\n Enter your choice: ";
cin>>choice;
clrscr();
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::in|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<<" Address: ";
gets(address);
cout<<" Phone no: ";
gets(phone);

file.seekg(pos);
file.write((char*)this,sizeof(hotel));
cout<<"\n Record is modified....!!";
flag=1;
break;
   }
}

if(flag==0)
cout<<"\n Sorry Room no. not found or vacant...!!";
file.close();
}

void hotel::delete_rec(int r)
{
int flag=0;
char ch;
ifstream fin("Record.dat",ios::in);
ofstream fout("temp.dat",ios::out);
while(!fin.eof())
{
fin.read((char*)this,sizeof(hotel));
if(room_no==r)
{
cout<<"\n Name: "<<name;
cout<<"\n Address: "<<address;
cout<<"\n Pone No: "<<phone;
cout<<"\n\n Do you want to delete this record(y/n): ";
cin>>ch;

if(ch=='n')
fout.write((char*)this,sizeof(hotel));
flag=1;
}
else
fout.write((char*)this,sizeof(hotel));
}

fin.close();
fout.close();
if(flag==0)
cout<<"\n Sorry room no. not found or vacant...!!";
else
{
remove("Record.dat");
rename("temp.dat","Record.dat");
}
}


void main()
{
hotel h;
textmode(C80);
textbackground(WHITE);
textcolor(RED);

clrscr();
cout<<"\n\t\t\t****************************";
cout<<"\n\t\t\t* HOTEL MANAGEMENT PROJECT *";
cout<<"\n\t\t\t****************************";
sleep(2);

cout<<"\n\n\n\n\t\tMade By:";
sleep(1);
cout<<"\tThe Crazy Programmer";
sleep(1);
cout<<"\n\n\t\tSubmitted To:";
sleep(1);
cout<<"\tMrs. Rakhi Jain";
sleep(1);
cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!";
getch();
h.main_menu();
}
Email ThisBlogThis!Share to XShare to Facebook

0 comments:

Post a Comment

Newer Post Home Older Post
Subscribe to: Post Comments (Atom)

Like Me On Facebook Mr. Deadly Hacker

About The Author

Unknown
View my complete profile
Aman Badhania writes this blog to help computer users with problems related to web services and getting the most out of their own websites.
Feel The Power Of Cyber Hacking Mr. DeadlyHacker

Popular

    The 5 Worst Computer Viruses The 5 Worst Computer Viruses
    no image Report: Xbox 720 Coming Next Year
    List of google dorks for sql injunction List of google dorks for sql injunction
    no image Dork: inurl:prodotto.php?id)
    Get Serial Number Of Any Software - Using Google Get Serial Number Of Any Software - Using Google
    no image How to Increase Internal Memory of Android
    NFS MOST Wanted 2 Full SPEED Download NFS MOST Wanted 2 Full SPEED Download

TemplateHits

  • Home
  • About Me
  • Serial Keys 1million
  • Password Hacking
  • Telnet
  • Hacking
  • Download
  • C Language Tips and Trick
Feel The Power Of Cyber Hacking Mr. DeadlyHacker

Hacking Tricks

Hacked Window Hacking Tools Window Software Window 8 Window Tips How To Make Window Genuiene Window 7 Hacking tutorial IP Tips Internet USB Hacking Hardware IGI 3 Internet Tricks Torrent HD movie HTML Hacker Types Hacking Game Hacking Tips Happy Deepawali Hard Disk Hardware Hacking HitMan Game HoneyPot Hosting IGI 2013 Image 2 Text Information Intrusion Detection System (IDS) Tekken 6 Telnet Terminator RAT TrueCaller UserName VLC Player Hacking Virus Visual Script Tricks Window 10 Window 8 Hack Window 9 Window News Window Server Youtube Tips Zombie iPhone

Crack Skull

Crack Skull
Shiiiiiiiiiiiiiiii.....Don't Live This

Followers

Deadly Tricks

Android Android Tips Android Apps Android Hack AntiVirus Hack Aman Badhania About Keylogging Backtrack Blogger Tips Backup Trick Batch Programming Browser APT Access Block Sites Advance Persistant Threat Albert Einstein Android Code Android Games Android Smart Phone Angry birds Application Assassin’s Creed III AutoCad Batch Hacking Blogger tools Bolloywood Movie HD
Facebook Hacking Firefox Imp. Addons Facebook Tips Download Facbook hack Deadly Hacker Desktop Hacking Exploits Email Hacking Data Recovery Desktop Apps Disable Mouse Dos Tools Drawing Arts Drive Icon Change Ethical Hacking Learn File hosting Firefox Download Flash Software

More Tricks

Software Proxy Server Password Hacking Software hacking Opreting System Partition Make Programming Of linux Remix Hacking Reverse Engineering Samsung Mobile Hacking Skin Pack For Window 7 System Hacking Open Source Code PC Hack PenDrive Bootable PenDrive Hacking Phishing Attacks Phreaking Proxy Sites RainMeters Recover Recover Deleted Files Red Hat Registry Hack Reinstall Your All Drivers In 5 MinutesThis is a featured page Resume Spear Phishing
Computer Hacking Backtrack Blogger Tips Command Hacking Crash Computer Cross Site Scripting (XSS) Backup Trick Batch Programming Browser CRIMINAL HACKED Computer trick Batch Hacking Blogger tools Bolloywood Movie HD C# CSS Check Password Coin Box Calling Hacking Cryptography
Aman Badhania
Copyright © 2012 Hack Your Mind Right Now....! - and Deadly Hacker.