class hotel {
public:
........
void printUncleanedrooms();
private:
map < int, bool> _roomStatus;
list < int > _uncleanedRooms;
};
void hotel::printUncleanedrooms() {
for(list < int >::iterator iter=_uncleanedRooms.begin(); iter!= _uncleanedRooms.end();) {
if(_roomStatus[*iter])
_uncleanedRooms.erase(iter++);
else
cout
}
}
Just a sample
所有跟帖:
• need to add "++iter" in the second case -亂彈- ♂ (0 bytes) () 05/10/2009 postreply 12:39:09
• xiexie. -戲雨飛鷹- ♀ (0 bytes) () 05/10/2009 postreply 13:59:08