Home > Backend Development > C++ > body text

In the C graphics library, the bar() function is used to draw a rectangular bar

WBOY
Release: 2023-09-10 14:25:01
forward
1248 people have browsed it

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.

Syntax

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}.

Program

#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;
}
Copy after login

Output

In the C graphics library, the bar() function is used to draw a rectangular bar

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!