-->

program to draw a rectangle.




//drawing rectangle
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver, gmode;    //variables declaration
gdriver=DETECT;        // detection of graphics driver

initgraph(&gdriver, &gmode, "c:\\tc\\BGI");
       /* initialize graphics and local variables with path in TC folder*/
       /* gmode is for graphics mode you want to work. */
rectangle(20,20,200,200);//(left,top) is the upper left corner of the
//rectangle, and (right,bottom) is its lower
//right corner.
//left is for x coordianate value and top is for
// y coordinate value . similarly right and bottom
// are for x and y coordinates res.
//give bigger value for all.
getch();          //gets one character from user and closes the graphics.
closegraph();     //closes graphics.h
}







No comments:

Post a Comment