本文整理汇总了C++中House::addRoom方法的典型用法代码示例。如果您正苦于以下问题:C++ House::addRoom方法的具体用法?C++ House::addRoom怎么用?C++ House::addRoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::addRoom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testHouse
void testHouse(){
cout << "-------------------------------------------------------------\n";
cout << "-------------- Testing class <House> ---------------------\n";
cout << "-------------------------------------------------------------\n";
cout << endl;
House myHouse;
Room kitchen("Kitchen", 3.9, 3.6);
Room childrenroom("Children room", 3.9, 2.7);
Room bedroom("Bedroom", 3.9, 3);
Room hall("Hall", 3.9, 4.5);
Room bathroom("Bathroom", 3.9, 2.7);
myHouse.addRoom(kitchen);
myHouse.addRoom(childrenroom);
myHouse.addRoom(childrenroom);
myHouse.addRoom(bedroom);
myHouse.addRoom(hall);
myHouse.addRoom(bathroom);
myHouse.print();
}
示例2: main
int main() {
House* myHouse = new House();
ifstream RoomInfo;
RoomInfo.open("roomInfo.txt");
string roomline;
while (getline(RoomInfo, roomline)) {
myHouse->addRoom(roomline);
}
myHouse->printRoomNames();
cout << "the area of my house is " << myHouse->calculateArea()
<< " square feet" << endl;
cin.get();
return 0;
}