VX公Z号:代码奇才
编写程序,计算圆柱体、球体、正方体和长方体的表面积和体积。
#include ""
#include""
class Shape
{
protected:
int x,y,h;
public:
void set(int i=0,int j=0,int z=0)
{
x=i;
y=j;
h=z;
}
virtual void area()=0;
virtual void volume()=0;
};
class Cylinder:public Shape
{
public:
void area()
{
cout