123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
#include <iostream.h> #include <stdio.h> #include <conio.h> #include "HotelQueueLinkedList.h" int main() { cout << "=========================================" << endl; cout << "\tROOM INFORMATION" << endl; cout << "=========================================" << endl << endl; HotelLinkedList* Cust = new HotelLinkedList(); Cust->insert(11, "Family", "Asmah", "2012-10-09", 59.00); int choice = 0; while (choice != 8) { cout << "--------" << endl << "Menu: " << endl << "--------" << endl; cout << "\t1: Book a Room" << endl; cout << "\t2: Display Room" << endl; cout << "\t3: Display Room in Reverse order" << endl; cout << "\t4: Display 1st Booked Room" << endl; cout << "\t5: Display last Booked Room" << endl; cout << "\t6: Search Room" << endl; cout << "\t7: Delete 1st customer" << endl; cout << "\t8: Exit" << endl; cout << "Choice (1 to 8): "; cin >> choice; switch(choice) { case 1: { cout << "---- Add New Booking ----" << endl; int c; double p; char t[50], a[50], d[10]; cout << "Enter Room No: "; cin >> c; cout << "Enter Room Type"; cin >> t; cout << "Enter Customer Name: "; cin >> a; cout << "Enter Booking Date: "; cin >> d; cout << "Enter Price: RM "; cin >> p; Cust->insert(c,t,a,d,p); } break; // option 1 case 2: { cout << endl << "******** Room List ********" << endl << endl; Cust->display(); cout << endl << "******** End of List ********" << endl << endl; } break; // option 2 case 3: { cout << endl << "******** Room List (Reverse Order) ********" << endl << endl; Cust->displayReverse(); cout << endl << endl << "******** End of List ********" << endl; } break; // option 3 case 4: { cout << endl << "******** 1st customer in Queue ********" << endl << endl; cout << "1st customer in Queue: " << Cust->getFront() << endl << endl; } break; // option 4 case 5: { cout << endl << "******** Last customer in Queue ********" << endl << endl; cout << "Last customer in Queue: " << Cust->getRear() << endl << endl; } break; // option 5 case 6: { cout << endl << "******** Search Room ********" << endl << endl; cout << "Enter Room No: "; int sk; cin >> sk; bool jumpa = Cust->search(sk); if (jumpa) { cout << "Room No " << sk << " is available" << endl; cout << "--------------------" << endl; } else cout << "Room not found! or have been booked!" << endl; } break; // option 6 case 7: { cout << endl << "******** Delete 1st Customer ********" << endl << endl; cout << "Customer " << Cust->deleteData() << " will be deleted..." << endl; cout << "Deleted!" << endl << endl; } break; // option 7 default: cout << "Invalid choice! Try again~" << endl << endl; } // end switch } // end while // option 8 cout << "Thank you for using this program~! :D" << endl << endl; delete Cust; getch(); //thank user for using program, exit }
<iostream>
<cstdio>