C/C++ graphics bar function


C/C++ graphics bar function


bar() :


It is used to draw the bar. It draws filled-in,rectangular,two-dimensional bar.

Syntax :

bar(int left,int top,int right,int bottom);

(left,top) is the upper left corner of the bar and

(right,bottom) is the bottom right corner of the bar.


Difference between bar and rectangle :

The rectangle is not solid filled whereas the bar will be solid filled.

Example :

#include <stdio.h>
#include <conio.h>

void main()
{
int d,m;
int midx,midy;

d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi");

midx=getmaxx()/2;
midy=getmaxy()/2;

bar(midx+50,midy+50,midx-50,midy-50); //solid bar

getch();
closegraph();
}

Output :

0 comments:

Post a Comment