习题4.12建立一个基类Building,用来存储一座楼房的层数、房间数以及它的总平方英尺数。建立派生类Housing,继承Building,并存储下面的内容:卧室和浴室的数量,另外,建立派生类Office,继承Building,并存储灭火器和电话的数目。然后,编制应用程序,建立住宅楼对象和办公楼对象,并输出它们的有关数据。1.2.#includeiostream.h3.classbuilding{4.protected:5.intfr;6.intr;7.doublem;8.public:9.building(inta,intb,doublex)10.{fr=a;r=b;m=x;}11.};12.classhouse:publicbuilding{13.private:14.intbr;15.intdr;16.public:17.house(inta,intb,doublex,intc,intd):building(a,b,x)18.{br=c;dr=d;}19.voidshow()20.{cout楼房层数:frendl;21.cout房间数:rendl;22.cout楼房总面积:mendl;23.cout卧室数量:brendl;24.cout浴室数量:drendl;25.}26.};27.classoffic:publicbuilding{28.private:29.intmr;30.inttr;31.public:32.offic(inta,intb,doublex,intc,intd):building(a,b,x)33.{mr=c;tr=d;}34.voidshow()35.{cout楼房层数:frendl;36.cout房间数:rendl;37.cout楼房总面积:mendl;38.cout灭火器数量:mrendl;39.cout电话数量:trendl;40.}41.};42.voidmain()43.{houseob1(10,200,300000,500,300);44.officob2(18,560,2500000,1500,600);45.cout住宅楼endl;46.ob1.show();47.cout\n办公大楼endl;48.ob2.show();49.}