Home > Backend Development > C++ > body text

Arc function in C language

WBOY
Release: 2023-09-13 16:09:06
forward
1670 people have browsed it

Arc function in C language

Functions in C language are defined in the graphics.h library.

In the C programming language, there is an option to create an arc using the given radius, center coordinates and radian.

arc()The function is defined in C’s graphics.h library

function Used to create an arc. This arc function is contained in the C language graphics.h library, which contains methods that can draw graphics on the output screen.

Syntax

void arc(int x, int y, int startangle, int endangle, int radius);
Copy after login

Now, let’s dive into the function and understand each parameter passed by the function and the output returned.

Parameters

x - Type = int, Function: Defines the x-coordinate of the center of the arc.

y - type = int, function: Defines the y coordinate of the center of the arc.

Start Angle - Type = int, Function: Defines the starting angle of the arc.

End angle - Type = int, Function: Defines the ending angle of the arc.

radius - type = int, function: Defines the radius of the arc.

Example

#include <graphics.h>
int main(){
   int gd = DETECT, gm;
   int x = 250;
   int y = 250;
   int start_angle = 155;
   int end_angle = 300;
   int radius = 100;
   initgraph(&gd, &gm, "");
   arc(x, y, start_angle, end_angle, radius);
   getch();
   closegraph();
   return 0;
}
Copy after login

The above is the detailed content of Arc function in C language. 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