C program to initialize the graph and draw a rectangle

Complete program to initialize the graph and draw a rectangle

#include<graphics.h> 
#include<conio.h> 
void main() 
{ 
int gd=DETECT; /* Detects the graph driver dynamically */ 
int gm; *for graph mode*/ 
initgraph(&gd,&gm,””); 
rectangle(10,10,200,200,); /* This function draws a rectangle 
taking co-ordinates (10,10) as top left point and target co-ordinates (200,200) 
as botton right co-ordinates. These co-ordinates are specified in terms of pixels 
*/ 
getch(); 
colsegraph(); /* closes the graph mode */ 
}

Leave a Comment