#include<conio.h>
#include<graphics.h>
void main()
{
int x1,y1; // left top coordinates
int x2,y2; // right bottom cordinates
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
clrscr();
printf("Enter the coordinates of left top position ");
printf("x1 : ");
scanf("%d",&x1);
printf("y1 : ");
scanf("%d",&y1);
printf("Enter the coordinates of right bottom position ");
printf("x2 : ");
scanf("%d",&x2);
printf("y2 : ");
scanf("%d",&y2);
printf("The required rectangle is : ");
rectangle(x1,y1,x2,y2);
getch();
closegraph();
}
|
|
| To draw a bar on the output screen whose parameters are user defined |
|
| |
|
|
|
|