예제 #1
0
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
0
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;
}