How To Use Rectangle In C Or C++ Graphics

rectangle function

INTRODUCTION :

In this article I will show you how to draw rectangle by C or C++ using rectangle function. rectangle is built-in function in graphics header

Declaration :

rectangle(int l, int t, int r, int b);

How to use :

For use this function you have to install turboc++. In this example I will show you how to draw a rectangle using C or C++ programing. The following code draws a rectangle. Just create a c file in turboc++ and copy paste following code in it.

/*Developed by Puskar Jasu*/
#include <graphics.h>
#include <conio.h>
main()
{
    int l, t, r, b;
    int graphic_driver = DETECT, graphic_mode;
    initgraph(&graphic_driver, &graphic_mode, "//turboc3/bgi");
    setcolor(4);
    l = 200;
    t = 100;
    r = 400;
    b = 300;
    rectangle(l, t, r, b);
    getch();
    closegraph();
    return 0;
}

Output :

you can see the output in your pc.

Rectangle output

CONCLUSION :

In this article I show you how you draw rectangle in C graphics by turboc++. Thanks for visit my site.

You can see my following project :

You can see my following program :

Post navigation

Scroll to Top