#include
using namespace std;
#define PI 3.1415926
class container
{
public:
double radius;
virtual double area()=0;
virtual double volume()=0;
};
//正方体类
class cube:public container
{
public:
double area()
{
return 6*radius*radius;
}
double volume()
{
return radius*radius*radius;
}
};
//圆柱体类,其中必须要有高才能计算
class cylinder:public container
{
public:
double highth;
double area()
{
return 2*PI*radius*radius+2*PI*radius*highth;
}
double volume()
{
return PI*radius*radius*highth;
}
};
//球体类
class sphere:public container
{
public:
double area()
{
return 4*PI*radius*radius;
}
double volume()
{
return 4*PI*radius*radius*radius/3;
}
};
void main()
{
cube m;
cylinder n;
sphere p;
int i=1;
double j,k;
while(i)
{
cout