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
// C Implementation for getarccoords() #include <graphics.h> #include <stdio.h> // driver code int main() { // gm is Graphics mode which is // a computer display mode that // generates image using pixels. // DETECT is a macro defined in // "graphics.h" header file int gd = DETECT, gm; // p is structure variable // of type arccoordstype struct arccoordstype p; char arr[100]; // initgraph initializes the // graphics system by loading a // graphics driver from disk initgraph(&gd;, &gm;, ""); // arc function is used to draw an // arc the first 2 arguments are // center of arc 3rd and 4th // arguments are starting and // ending angles. Last argument // is the radius. arc(250, 200, 0, 90, 100); // getarccoords function which takes // address of a structure variable of // type arccoordstype as an argument. getarccoords(&p;); // sprintf stands for “String print”. // Instead of printing on console, it // store output on char buffer which // are specified in sprintf sprintf(arr, "(%d, %d)", p.xstart, p.ystart); // outtext function displays text // at current position. outtextxy(360, 195, arr); sprintf(arr, "(%d, %d)", p.xend, p.yend); outtextxy(245, 85, arr); getch(); // closegraph function closes the // graphics mode and deallocates // all memory allocated by // graphics system . closegraph(); return 0; } |
chevron_right
filter_none
Output :
Recommended Posts:
- arc function in C
- putchar() function in C
- Inline function in C
- iswblank() function in C/C++
- raise() function in C++
- feupdateenv() function in C++
- exp2() function in C++ STL
- iswpunct() function in C/C++
- towupper() function in C/C++
- iswxdigit() function in C/C++
- strrev() function in C
- iswctype() function in C/C++
- strcspn() function in C/C++
- atexit() function in C/C++
- strrchr() function in C/C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



