Home > Article > Backend Development > In the C graphics library, the bar() function is used to draw a rectangular bar
bar() function is a C graphics function used to draw graphics in the C programming language. The graphics.h header file contains functions for drawing graphics. The bar() function is also defined in the header file.
void bar(int left, int top, int right, int bottom);
The bar() function is used to draw a bar (bar chart) , it is a two-dimensional graph. It is a filled rectangular shape. This function accepts four parameters, namely the (X, Y) coordinates of the upper left corner of the bar {left and top} and the (X, Y) coordinates of the lower right corner of the bar {right and bottom}.
#include <graphics.h> #include <conio.h> int main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\TC\BGI"); bar(120, 120, 250, 250); getch(); closegraph(); return 0; }
The above is the detailed content of In the C graphics library, the bar() function is used to draw a rectangular bar. For more information, please follow other related articles on the PHP Chinese website!