• Have Any Question?
  • contact@eitworld.com

Rectangle() Function





rectangle() function is used to draw a rectangle of the specified length and breadth.

Declaration

void rectangle(int left, int top, int right, int bottom);
  • rectangle() contains forr parameters left, top, right and bottom.
  • top-left and right- bottom coordinates are required to draw the bar.
  • left specifies the X-coordinate of the top-left corner.
  • top specifies the Y-coordinate of the top-left corner.
  • right specifies the X-coordinate of the right-bottom corner.
  • bottom specifies the Y-coordinate of the right-bottom corner.
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,” “);

rectangle(100,200,200,275);

getch();

closegraph();

}

Above program is used to draw a rectangle of length 100 cm and breadth 75cm with top-left position (100,200) and right-bottom position (200,275) on the screen.

Output

c graphics



Real Time Web Analytics