⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rectangle.cpp

📁 教材例子
💻 CPP
字号:
//程序TECTANGLE.CPP(8.6.5)	功能:矩形类RECTANGLE的类实现
#include "figstack.h"
RECTANGLE::RECTANGLE(int x, int y, int len, int wid):FIGURE(x, y)
{
	this->length=len;
	this->width=wid;
}
void RECTANGLE::show()
{
	if(!is_visible()){
		visible=TRUE;
		rectangle(x_pos, y_pos-width, x_pos+length, y_pos);
	}
}
void RECTANGLE::hide()
{
	int temp_color;
	if(is_visible()){
		temp_color=getcolor();
		setcolor(getbkcolor());
		visible=FALSE;
		rectangle(x_pos, y_pos-width, x_pos+length, y_pos);
		setcolor(temp_color);
	}
}
void RECTANGLE::expand(int delta)
{
	this->hide();
	if(delta>0){
		length*=delta;
		width*=delta;
	}else if(delta<0){
		length/=-delta;
		width/=-delta;
	}
	this->show();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -