rectangle(),是一个
程序语言函数,功能是画一个矩形,用法为void far rectangle(int left, int top, int right, int bottom)。
用 法: void far rectangle(int left, int top, int right, int bottom);
参数说明:(left ,top )为矩形的左上坐标,(right,bottom)为矩形的右下坐标,两者可确定一个矩形的大小
程序例:
#include
#include
#include
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int left, top, right, bottom;
/* initialize graphics and local variables */
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
getch();
exit(1); /* terminate with an error code */
}
left = getmaxx() / 2 - 50;
top = getmaxy() / 2 - 50;
right = getmaxx() / 2 + 50;
bottom = getmaxy() / 2 + 50;
/* draw a rectangle */
rectangle(left,top,right,bottom);
/* clean up */
getch();
closegraph();
return 0;
}