We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,477 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

2d array

An integer double-dimensional array called hotel is used to keep track of reservations in an hotel of 5 floors each floor having 8 rooms. The floors are numbered 1, 2, 3, 4, and 5, and the rooms are numbered 1, 2, 3… 8. Write a C++ program to manage the hotel reservations by completing the following:

 Write a function called isFree, that takes the array hotel, the room number and the floor number, and returns true if that room on that floor is free, and false otherwise. A reserved room has a value of 1, whereas a free room has a value of 0.
 Write a function called reserveRoom, that takes the array hotel, the room number and the floor number, and reserves that room on that floor. Note that this function should use the function isFree to make sure the room to be reserved is free; otherwise the function should print a message saying the room is already reserved.
 Write a function called freeRoom, that takes the array hotel, the room number and the floor number, and frees that room on that floor.
 Write a function called countFree, that takes the array hotel, and returns the number of free rooms in the hotel.
 Write a function called showHotel, that takes the array hotel, and outputs the status of all rooms in the hotel. The output should look as follows for the hotel:

    R01 R02 R03 R04 R05 R06 R07 R08
F1  [x] [x] [ ] [ ] [ ] [x] [ ] [ ]
F2  [ ] [x] [x] [ ] [x] [ ] [ ] [ ]
F3  [x] [x] [ ] [ ] [ ] [ ] [x] [x]
F4  [ ] [x] [ ] [ ] [x] [ ] [x] [ ]
F5  [x] [ ] [x] [ ] [ ] [x] [x] [x]

Using the functions above, write a program that shows the hotel at the start (all rooms are free), then allows a user to manage the hotel through a menu (reserve, free, print, etc.).

4
Contributors
3
Replies
10 Hours
Discussion Span
4 Months Ago
Last Updated
5
Views
saraaw
Newbie Poster
1 post since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

what's your question about the problem?

zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 206
Skill Endorsements: 15

what's your question about the problem?

I think this is his assignement for school.

Speaking on my behalf, guys, I won't write your homeworks.

CGSMCMLXXV
Junior Poster in Training
54 posts since Jan 2013
Reputation Points: 5
Solved Threads: 7
Skill Endorsements: 0

As mentioned above, we cannot do your homework. However, if you attempt this code, and post the code you attempted, we could then give you a hand in helping you figure out how to do it.

Doogledude123
Junior Poster in Training
90 posts since Jun 2012
Reputation Points: 0
Solved Threads: 7
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0922 seconds using 2.68MB