#include #include #include #include #include using namespace std; class hotel { int room_no; char name[30]; char address[50]; char phone[10]; char food[10]; char drink[10]; char price[20]; public: void main_menu(); //to dispay the main menu void ayenew(); //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; cin>>choice; while(choice!=5) { system("cls"); cout<<"\n\t ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"; cout<<"\n\t ::::: MAIN MENU ::::::::"; cout<<"\n\t ::::: 1 BOOK A ROOM ::::::::"; cout<<"\n\t ::::: 2 Customer Record ::::::::"; cout<<"\n\t ::::: 3 Rooms Allotted ::::::::"; cout<<"\n\t ::::: 4 Edit Record ::::::::"; cout<<"\n\t ::::: 5 Exit ::::::::"; cout<<"\n\t ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"; cout<<"\n\n\n\n\tEnter Your Choice: "; cin>>choice; switch(choice) { case 1: ayenew(); 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::ayenew() { system("cls"); int rediet,habtamu; ofstream fout("Record.dat",ios::app); cout<<"\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; cout<<"\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; cout<<"\nxxxx xxxx"; cout<<"\nxxxx Enter Customer Detalis xxxx"; cout<<"\nxxxx xxxx"; cout<<"\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; cout<<"\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; cout<<"\n\n Room no: "; cin>>rediet; habtamu=check(rediet); if(habtamu) cout<<"\n Sorry..!!!Room is already booked"; else { room_no=rediet; cout<<" Name: "; gets(name); cout<<" Address: "; gets(address); cout<<" Phone No: "; gets(phone); cout<<" the food that you want: "; gets(food); cout<<"the drink you want: "; gets(drink); cout<<" the cost that you use : "; gets(price); fout.write((char*)this,sizeof(hotel)); cout<<"\n Room is booked!!!"; } cout<<"\n Press any key to continue!!"; getch(); fout.close(); } void hotel::display() { system("cls"); ifstream fin("Record.dat",ios::in); int rediet,habtamu; cout<<"\n Enter room no: "; cin>>rediet; while(!fin.eof()) { fin.read((char*)this,sizeof(hotel)); if(room_no==rediet) { system("cls"); cout<<"\n Cusromer Details"; cout<<"\n ****************"; cout<<"\n Room no: "<>choice; system("cls"); cout<<"\n Enter room no: "; cin>>rediet; switch(choice) { case 1: modify(rediet); break; case 2: delete_rec(rediet); break; default: cout<<"\n Wrong Choice!!"; } cout<<"\n Press any key to continue!!!"; getch(); } int hotel::check(int rediet) { int habtamu=0; ifstream fin("Record.dat",ios::in); while(!fin.eof()) { fin.read((char*)this,sizeof(hotel)); if(room_no==rediet) { habtamu=1; break; } } fin.close(); return(habtamu); } void hotel::modify(int rediet) { long pos,habtamu=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==rediet) { cout<<"\n :::::::::::::::::::::::::::::::::"; cout<<"\n ::::::::::::::::::::::::::::::::::"; cout<<"\n ::::: Enter New Details :::::"; cout<<"\n ::::::::::::::::::::::::::::::::::"; cout<<"\n ::::::::::::::::::::::::::::::::::"; cout<<"\n Name: "; gets(name); cout<<" Address: "; gets(address); cout<<" Phone no: "; gets(phone); cout<<" food: "; gets(food); cout<<" drink: "; gets(drink); cout<<" Price: "; gets(price); file.seekg(pos); file.write((char*)this,sizeof(hotel)); cout<<"\n Record is modified!!"; habtamu=1; break; } } if(habtamu==0) cout<<"\n Sorry Room no. not found or vacant!!"; file.close(); } void hotel::delete_rec(int rediet) { int habtamu=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==rediet) { cout<<"\n Name: "<>ch; if(ch=='n') fout.write((char*)this,sizeof(hotel)); habtamu=1; } else fout.write((char*)this,sizeof(hotel)); } fin.close(); fout.close(); if(habtamu==0) cout<<"\n Sorry room no. not found or vacant!!"; else { remove("Record.dat"); rename("temp.dat","Record.dat"); } } int main() { hotel h; system("cls"); cout<<"\n\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; cout<<"\n\t@@@@@ @@@@@@"; cout<<"\n\t@@@@@ @@@@@@"; cout<<"\n\t@@@@@ WELLCME TO OUR @@@@@@"; cout<<"\n\t@@@@@ HOTEL MANAGEMENT PROJECT @@@@@@"; cout<<"\n\t@@@@@ DEAR OUR STRANGER @@@@@@"; cout<<"\n\t@@@@@ @@@@@@"; cout<<"\n\t@@@@@ @@@@@@"; cout<<"\n\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; cout<<"\n\n WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"; cout<<"\n WWWWWWWWW WWWWWWW"; cout<<"\n WWWWWWWWW THISE PROJECT IS DEVOLOPED BY WWWWWWW"; cout<<"\n WWWWWWWWW FIRSIT YEAR INFORMATION SYSTEM WWWWWWW"; cout<<"\n WWWWWWWWW STUDENTS IN WOLLO UNIVERCITY WWWWWWW"; cout<<"\n WWWWWWWWW KIOT CAMPASS IN GINBOT 29/2009 E.C WWWWWWW"; cout<<"\n WWWWWWWWW WWWWWWW"; cout<<"\n WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"; cout<<"\n\n\n\t SET BY :"; cout<<"\n\n\t GRUUP 5 MEMBERS "; cout<<"\n\n\t\t\t\tPress any NUMERIC key to continue..........."; getch(); h.main_menu(); }