#include<iostream>
#include<cmath>
#include<iomanip>
#ifndef CSHAPE_H
#define CSHAPE_h
usingnamespace std;
constfloat PI=3.1;
class CShape//CShape抽象类定义
{
public:
virtualfloat length()//图形长度
{
return 0.0;
}
virtualfloat area()//图形面积
{
return 0.0;
}
virtualfloat valum()//图形体积
{
return 0.0;
}
virtualfloat zc()//图形周长
{
return 0.0;
}
virtualvoid draw()=0;//描绘图形
};
class CPoint:virtualpublic CShape//CPoint类定义
{
protected:
float x,y;
public:
CPoint(float a,float b)
{
x=a;
y=b;
}
void setpoint(float a,float b)
{
x=a;
y=b;
}
void draw()
{
cout<<"点的坐标为:"<<"("<<x<<","<<y<<")"<<endl;
}
};
class CLine:virtualpublic CShape//线类定义
{
protected:
float x,y,z,k;
public:
CLine(float a,float b,float c,float d)
{
x=a;
y=b;
z=c;
k=d;
}
void setline(float a,float b,float c,float d)
{
x=a;
y=b;
#include<cmath>
#include<iomanip>
#ifndef CSHAPE_H
#define CSHAPE_h
usingnamespace std;
constfloat PI=3.1;
class CShape//CShape抽象类定义
{
public:
virtualfloat length()//图形长度
{
return 0.0;
}
virtualfloat area()//图形面积
{
return 0.0;
}
virtualfloat valum()//图形体积
{
return 0.0;
}
virtualfloat zc()//图形周长
{
return 0.0;
}
virtualvoid draw()=0;//描绘图形
};
class CPoint:virtualpublic CShape//CPoint类定义
{
protected:
float x,y;
public:
CPoint(float a,float b)
{
x=a;
y=b;
}
void setpoint(float a,float b)
{
x=a;
y=b;
}
void draw()
{
cout<<"点的坐标为:"<<"("<<x<<","<<y<<")"<<endl;
}
};
class CLine:virtualpublic CShape//线类定义
{
protected:
float x,y,z,k;
public:
CLine(float a,float b,float c,float d)
{
x=a;
y=b;
z=c;
k=d;
}
void setline(float a,float b,float c,float d)
{
x=a;
y=b;