The header file graphics.h contains arc() function which draws an arc with center at (x, y) and given radius. start_angle is the starting point of angle and end_angle is the ending point of the angle. The value of the angle can vary from 0 to 360 degree.
Syntax :
void arc(int x, int y, int start_angle,
int end_angle, int radius);
where,
(x, y) is the center of the arc.
start_angle is the starting angle and
end_angle is the ending angle.
'radius' is the Radius of the arc.
Examples :
Input : x=250, y=250, start_angle = 155, end_angle = 300, radius = 100
Output :
Input : x=250, y=250, start_angle = 0, end_angle = 300, radius = 100;
Output :
Below is the implementation of arc() function :
#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;
}
|
Output:
Last Updated :
23 May, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...