求助C++画圆

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:22:19
用圆心半径法画圆。第一次单击选中圆的圆心,此时鼠标移动时会拖动一个圆,再次单击会选中圆上的一点而形成一个圆,右击时会擦除橡皮圆,放弃圆的绘制。
这类圆用C++怎么写啊~~求高手给出完整的程序,谢谢了

#define TRUE 1
#define FALSE 0
#include <graphics.h>
#include <stdio.h>
#include <conio.h>

class Cposition
{
protected:
int x,y;
public:
void setposition(int X, int Y) {x=X; y=Y; }
Cposition(int X, int Y) {x=X; y=Y; }
Cposition() {x=y=0; }
};

class Cpoint:public Cposition
{
protected:
bool m_bvisible;
public:
Cpoint(int X,int Y):Cposition(X,Y){;}
Cpoint():Cposition(){;}
virtual void show();
virtual void hide();
void moveto(int X, int Y)
{ if (m_bvisible) {hide(); x=X; y=Y; show();}
else {x=X;y=Y;} }
bool visible() {return m_bvisible;}
};
#define PI 3.1415926
void Cpoint::show()
{
putpixel(x,y,15);
m_bvisible=TRUE;
}

void Cpoint::hide()
{
putpixel(x,y,0);
m_bvisible=FALSE;
}

class Ccircle:public Cpoint
{