#include
using namespace std;
class CPoint
{public:
CPoint(){x=0;y=0;}
float GetX(){return x;}
float GetY(){return y;}
void SetX(float a){x=a;}
void SetY(float b){y=b;}
private:
float x,y;
};
class CRectangle
{public:
CRectangle()
{
L.SetX(2);
L.SetY(5);
R.SetX(6);
R.SetY(8);
}
void SetLPoint(float c,float d)
{
cout<<"修改左下角坐标"<
L.SetX(c);
L.SetY(d);
}
void SetRPoint(float e,float f)
{
cout<<"修改右上角坐标"<
R.SetX(e);
R.SetY(f);
}
float GetPerimeter(){return 2*(R.GetX()+R.GetY()-L.GetX()-L.GetY());}
float GetArea(){return (R.GetX()-L.GetX())*(R.GetY()-L.GetY());}
private:
CPoint R,L;
};
int main()
{
CRectangle a_rectagnle;
cout<<"周长1="<
a_rectagnle.SetRPoint(7,9);
cout<<"周长2="<
return 0;
}
又是作业题!