Rectangle in c/c++ graphics
Rectangle in c/c++ graphics
rectangle() :
This function is used to draw rectangle. It draws the rectangle in the current line style,
thickness and drawing color.
Syntax :
rectangle(int left,int top,int right,int bottom);
(left,top) is the upper left corner of the rectangle and
(right,bottom) is the bottom right corner of the rectangle.
Example :
#include <graphics.h>
#include <conio.h>
void main()
{
int d,m;
int top,bottom,left,right;
int midx,midy;
d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi");
midx=getmaxx()/2;
midy=getmaxy()/2;
top=midx+50;
bottom=midy-50;
left=midx-50;
right=midy+50;
rectangle(left,top,right,bottom);
getch();
closegraph();
}
Output :
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment