circle.cpp
来自「教材例子」· C++ 代码 · 共 42 行
CPP
42 行
//程序CIRCLE.CPP(7.2.7) 功能:实现圆类CIRCLE的成员函数
#include "basgraph.h"
CIRCLE::CIRCLE(int x, int y, int r):POINT(x, y)
{
radius=r;
}
void CIRCLE::show()
{
if(!is_visible()){
visible=TRUE;
circle(x_pos, y_pos, radius);
}
}
void CIRCLE::hide()
{
unsigned int temp_color;
if(is_visible()){
temp_color=getcolor();
setcolor(getbkcolor());
visible=FALSE;
circle(x_pos, y_pos, radius);
setcolor(temp_color);
}
}
void CIRCLE::move_to(int x, int y)
{
hide();
x_pos=x;
y_pos=y;
show();
}
void CIRCLE::expand(int delta)
{
hide();
radius+=delta;
if(radius<0) radius=0;
show();
}
void CIRCLE::contract(int delta)
{
expand(-delta);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?