Question: Explain why we used these 2 functions in our code: Bookroom function and custRecord function. kindly describe the code which is included in bookroom function

Explain why we used these 2 functions in our code: Bookroom function and custRecord function.

kindly describe the code which is included in bookroom function and custRecord function.

Thanks

#include #include #include using namespace std; struct System //declaration of struct System { string name; string phone; int room; } ; int roomnum; int Menu (); string bookRoom (int&); void custRecord (System[]); void roomStatus (System[]); void editRecord (System*); void file (System[]); int main() { int x; char key; System hotel[50]; //declaration of hotel array with type System cout<<" ********************"<>roomnum; //prompt user to enter new room number } hotel[roomnum].room=1; //1 will assigned to room chosen by user to book the room cout<<"Enter name : "; cin>>hotel[roomnum].name; //prompt user to enter information cout<<"Enter phone number : "; cin>>hotel[roomnum].phone; cout<>x; } cout<<"Do you want to save the data before quitting? (press Y for yes) : "; cin>>key; if (key=='y' || key=='Y') file(hotel); //if yes ; function to save data in file hotel.txt else cout<<"Data is not saved. Thank you."; return 0; //program ends } int Menu () { int choice; cout<<" MENU"<>choice; return choice; //return choice to the main function } string bookRoom (int& roomnum) //function to book a room { string type; cout<>roomnum; while (roomnum<1 || roomnum>49) { cout<<"Room does not exist. Please re-enter : "; //displayed message if the room entered does not exist cin>>roomnum; } if (roomnum>=1 && roomnum<=14) type="SINGLE BED"; else if (roomnum>=15 && roomnum<=29) type="DOUBLE BED"; else if (roomnum>=30 && roomnum<=39) type="STUDIO"; else if (roomnum>=40 && roomnum<=49) type="SUITE"; return type; //return type of room to the main function } void custRecord (System hotel[]) //void function to see customer record with parameter System hotel[] { cout<>j; if (hotel[j].room==1){ //display the record if the room is booked cout<<" Record for room "<>choice; cout<>hotel[j].name; //enter new record cout<<"Enter new customer's phone number : "; cin>>hotel[j].phone; cout<<"RECORD SUCCESSFULLY MODIFIED"<>key; if (key=='y' || key=='Y') editRecord (hotel); //go back to the function to edit record } return; //return to main function } void file (System hotel[]) //function to save record in a file { ofstream outFile; string filename = "hotel.txt"; outFile.open(filename.c_str()); if (outFile.fail()) { cout<<"hotel.txt can't be opened."<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!