#include<iostream.h>#include "12307130175exe5-1面积输入.c"class A{private:float x,y,width;public:A(float x0,float y0,float width0){x=x0;y=y0;width=width0;}float area(){return width*width;}};
class B:public A{private:float x,y,width,high;public:B(float x0,float y0,float width0,float high0):A(x0, y0, width0){high=high0;}float area(){return width*high;}};
class C:public B{private:float x,y,z,width,high,depth;public:C(float x0,float y0,float z0,float width0,float high0,float depth0):B(x0,y0,width0,high0){depth=depth0;}float area(){return 2*(width*high+width*depth+depth*high);}};
void main(){int i;float *a;a= new float[6];i=scf(a);if(i==3){cout << "图形为正方形,面积为: " << endl;A w(a[0],a[1],a[2]);cout << w.area() << endl;}elseif(i==4) {cout << "图形为长方形,面积为:" << endl;B w(a[0],a[1],a[2],a[3]);cout << w.area() << endl;}else{cout << "图形为长方体,表面积为:" << endl;C w(a[0],a[1],a[2],a[3],a[4],a[5]);cout << w.area() << endl;}}