类描述点特征

POINT5.H



// 类描述点特征 POINT5.H 谢春 2001.1.1.

#include<iostream.h> //包含输入输出流
#include<graphics.h> //包含图形库函数
#include<conio.h> //包含输入输出函数
#include<stdlib.h> //包含标准库

class point5
{
int x,y,color;
public: //公有成员
point5() {} //成员函数
point5(int ix,int iy,int c) {x=ix; y=iy; color=c;}
void set_point5(int ix,int iy,int c) {x=ix; y=iy; color=c;}

int get_x() {return x;} //操作代码
int get_y() {return y;}
int get_color() {return color;}

void show(); //点亮函数说明
void hide(); //隐藏函数说明
};

void point5::show() //点亮函数定义
{ //类Point作用域(::)成员函数show()
putpixel(x,y,color);
putpixel(x-1,y,color); putpixel(x,y-1,color);
putpixel(x+1,y,color); putpixel(x,y+1,color);
putpixel(x-2,y,color); putpixel(x,y-2,color);
putpixel(x+2,y,color); putpixel(x,y+2,color);
putpixel(x-3,y,color); putpixel(x,y-3,color);
putpixel(x+3,y,color); putpixel(x,y+3,color);
putpixel(x-4,y,color); putpixel(x,y-4,color);
putpixel(x+4,y,color); putpixel(x,y+4,color);
putpixel(x-5,y,color); putpixel(x,y-5,color);
putpixel(x+5,y,color); putpixel(x,y+5,color);
};

void point5::hide() //隐藏函数定义
{ //类Point作用域(::)成员函数hide()
putpixel(x,y,0);
putpixel(x-1,y,0); putpixel(x,y-1,0);
putpixel(x+1,y,0); putpixel(x,y+1,0);
putpixel(x-2,y,0); putpixel(x,y-2,0);
putpixel(x+2,y,0); putpixel(x,y+2,0);
putpixel(x-3,y,0); putpixel(x,y-3,0);
putpixel(x+3,y,0); putpixel(x,y+3,0);
putpixel(x-4,y,0); putpixel(x,y-4,0);
putpixel(x+4,y,0); putpixel(x,y+4,0);
putpixel(x-5,y,0); putpixel(x,y-5,0);
putpixel(x+5,y,0); putpixel(x,y+5,0);
};