getarcoords() function in C
The header file graphics.h contains getarccoords() function which is used to get coordinates of arc which is drawn most recently. arccoordstype is a predefined structure which is defined as follows:
Syntax :
struct arccoordstype
{
// center point of arc
int x, y;
// start position
int xstart, ystart;
// end position
int xend, yend;
};
Note : address of a structure variable of type arccoordstype is passed to function getarccoords.
Syntax :
void getarccoords(struct arccoordstype *var);
Example :
Input : x = 250, y = 200, s_angle = 0 ,
e_angle = 90, radius = 100
Output :
Below is the implementation of getarccoords() function
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd = DETECT, gm;
struct arccoordstype p;
char arr[100];
initgraph(&gd, &gm, "" );
arc(250, 200, 0, 90, 100);
getarccoords(&p);
sprintf (arr, "(%d, %d)" , p.xstart,
p.ystart);
outtextxy(360, 195, arr);
sprintf (arr, "(%d, %d)" , p.xend,
p.yend);
outtextxy(245, 85, arr);
getch();
closegraph();
return 0;
}
|
Output :
Last Updated :
23 Jan, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...