Q:

Getarcoords function in C using graphics.h

0

Getarcoords function in C using graphics.h

Declaration: void getarccoords(struct arccoordstype *var);

getarccoords function is used to get coordinates of arc which is drawn most recently. arccoordstype is a predefined structure which is defined as follows:

struct arccoordstype
{
   int x, y;                /*   center point of arc    */
   int xstart, ystart;      /*   start position         */
   int xend, yend;          /*   end position           */

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include
#include
#include

main()
{
   int gd = DETECT, gm;
   struct arccoordstype a;
   char arr[100];

   initgraph(&gd, &gm,"C:\\TC\\BGI");

   arc(250,200,0,90,100);
   getarccoords(&a);

   sprintf(arr,"(%d, %d)",a.xstart,a.ystart);
   outtextxy(360,195,arr);

   sprintf(arr,"(%d, %d)",a.xend,a.yend);
   outtextxy(245,85,arr);

   getch();
   closegraph();
   return 0;
}

In the program, we have drawn an arc, and then we get the coordinates of its endpoints using getarccoords. Coordinates so obtained are displayed using outtextxy.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now