To draw an rectangle

//To draw an rectangle

#include<iostream.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int x1,y1,x2,y2;
cout<<“\n\t\t\t\*To draw an rectangle*\n”;
cout<<“\nenter the x coordinates(x1 and y2):-\n”;
cin>>x1>>x2;
cout<<“\nenter the y coordinates(y1 and y2):-\n”;
cin>>y1>>y2;
int gd=DETECT,gm;
initgraph(&gd,&gm,””);
setbkcolor(WHITE);
setcolor(8);
line(x1,y1,x2,y1);
line(x2,y2,x1,y2);
line(x2,y1,x2,y2);
line(x1,y2,x1,y1);
setcolor(8);
outtextxy(100,60,”rectangle”);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *