课程: C++ Standard Template Library

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Challenge: Sets and maps application

Challenge: Sets and maps application - C++教程

课程: C++ Standard Template Library

Challenge: Sets and maps application

- [Narrator] Now we are ready for a challenge. Here's the description. Suppose we want to keep track of guests in a hotel. For now the content will be just a name. Suppose that the hotel has 20 floors with 15 rooms each. Rooms are numbered as a composition of the floor number and the room number. For example room number 114 means the 14th room in the first floor. 502 means the second room in the fifth floor. And 1408 means the eighth room in the 14th floor. Make sure to not accept duplicates in your application. Here are some important details about this problem. First, guest objects may take considerable storage, not just a name. These could be objects that could take a considerable amount of memory. And in embedded applications or mobile applications, this could be a problem. Next, room numbers outside the format do not exist. Here are some examples of rooms numbers that don't exist. Two, 100, 1816, and 2204. Two doesn't exist because there is no floor number zero, 100 because there…

内容