#include
using namespace std;
class Point
{
public:
Point(int xx = 0,int yy = 0)
{
x = xx;
y = yy;
}
~Point(void)
{
}
protected:
int x,y;
};
class Circle:public Point
{
public:
Circle(int xx = 0,int yy = 0,int rr = 0)
{
Point(xx,yy);
r = rr;
}
~Circle(void)
{
}
void area(void)
{
double ar = 3.14*r*r;
cout<
protected:
int r;
};
class Cylinder:public Circle
{
public:
Cylinder(int xx = 0,int yy = 0,int rr = 0,int hh = 0)
{
Point(xx,yy);
Circle(xx,yy,rr);
h = hh;
}
~Cylinder(void)
{
}
void area(void)//表面积
{
double ar = 3.14*r*r*h/3;//具体的公式忘记了
cout<
void volume(void)//体积
{
double ar = ****;//体积公式忘记了,自己补充
cout<
private:
int h;
};
int main(void)
{
Circle cir(1,2,3);
cir.area();
Cylinder cy(1,2,3,4);
cy.area();
cy.volume();
system("pause");
return 0;
}