Home  >  Article  >  Backend Development  >  Arc function in C language

Arc function in C language

WBOY
WBOYforward
2023-09-13 16:09:061668browse

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);

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

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete