一个点Point类和矩形CRect类还要加什么代码以实现主程序的运行?

#include
using namespace std;
class Point
{
public:
int x;
int y;
Point(int x1=0,int y1=0)
{
x=x1;
y=y1;
}
};
class CRect
{
int x,y;
int width;
int height;
public:
CRect(int x1=0,int y1=0,int w=20,int h=20);
CRect(const CRect &r);
Point tl()
{
return Point(x,y);
}
int getWidth();
int getHeight();
void setTL(int x1,int y1)
{
x=x1;
y=y1;
}
void setWidth(int w);
void setHeight(int h);
void show();
};

Point CRect::br()
{
return Point(x+width-1,y+height-1);
}

void CRect::show()
{
cout<<"左上角坐标:"<<x<<","<<y<<endl;
cout<<"右下角坐标:"<<br().x<<","<<br().y<<endl;
}
int main()
{
CRect rect1(20,20,30,50);
rect1.show();
cout<<"____________"<<endl;
CRect rect2(rect1);
rect2.show();
CRect rect3[3]={CRect(10,10,10,10),CRect(20,20,20,20),CRect(30,30,30,30)};
cout<<"____________"<<endl;
for(int i=0;i<3;i++)
{
rect3[i].show();
}
CRect *p=new CRect[3];
p[1].setTL(3,5);
p[1].setWidth(20);
p[1].setHeight(30);
cout<<"____________"<<endl;
for(int i=0;i<3;i++)
{
p[i].show();
}
delete []p;
return 0;
}

如果问题得到解决,请点采纳

#include <iostream>

using namespace std;
class Point
{
public:
    int x;
    int y;
    Point(int x1=0,int y1=0)
    {
        x=x1;
        y=y1;
    }
};
class CRect
{
    int x,y;
    int width;
    int height;
public:
    CRect(int x1=0,int y1=0,int w=20,int h=20);
    CRect(const CRect &r);
    Point tl()
    {
        return Point(x,y);
    }
    Point br();
    int getWidth();
    int getHeight();
    void setTL(int x1,int y1)
    {
        x=x1;
        y=y1;
    }
    void setWidth(int w);
    void setHeight(int h);
    void show();
};
Point CRect::br()
{
    return Point(x+width-1,y+height-1);
}
void CRect::show()
{
    cout<<"左上角坐标:"<<x<<","<<y<<endl;
    cout<<"右下角坐标:"<<br().x<<","<<br().y<<endl;
}
int CRect::getWidth()
{
    return width;
}
int CRect::getHeight()
{
    return height;
}
void CRect::setWidth(int w)
{
    width = w;
}
void CRect::setHeight(int h)
{
    height = h;
}
CRect::CRect(int x1,int y1,int w,int h)
{
    width = w;
    height = h;
    x = x1;
    y = y1;
}
CRect::CRect(const CRect &r)
{
    width = r.width;
    height = r.height;
    x = r.x;
    y = r.y;
}
int main()
{
    CRect rect1(20,20,30,50);
    rect1.show();
    cout<<"____________"<<endl;
    CRect rect2(rect1);
    rect2.show();
    CRect rect3[3]={CRect(10,10,10,10),CRect(20,20,20,20),CRect(30,30,30,30)};
    cout<<"____________"<<endl;
    for(int i=0;i<3;i++)
    {
        rect3[i].show();
    }
    CRect *p=new CRect[3];
    p[1].setTL(3,5);
    p[1].setWidth(20);
    p[1].setHeight(30);
    cout<<"____________"<<endl;
    for(int i=0;i<3;i++)
    {
        p[i].show();
    }
    delete []p;
    return 0;
}

左上角坐标:20,20
右下角坐标:49,69


左上角坐标:20,20
右下角坐标:49,69


左上角坐标:10,10
右下角坐标:19,19
左上角坐标:20,20
右下角坐标:39,39
左上角坐标:30,30
右下角坐标:59,59


左上角坐标:0,0
右下角坐标:19,19
左上角坐标:3,5
右下角坐标:22,34
左上角坐标:0,0
右下角坐标:19,19
Press any key to continue . . .