Draw a circle with a given radius centered on (x, y)

From , 5 Years ago, written in C, viewed 184 times.
URL https://pastebin.vip/view/1368ba1a
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. int main ( void )
  7. {
  8.         /* request auto detection */
  9.         int gdriver = DETECT, gmode, errorcode;
  10.         int midx, midy;
  11.         int radius = 100;
  12.  
  13.         /* initialize graphics and local variables */
  14.         initgraph ( &gdriver, &gmode, "" );
  15.  
  16.         /* read result of initialization */
  17.         errorcode = graphresult();
  18.         if ( errorcode != grOk )  /* an error occurred */
  19.         {
  20.                 printf ( "Graphics error: %s\n", grapherrormsg ( errorcode ) );
  21.                 printf ( "Press any key to halt:" );
  22.                 getch();
  23.                 exit ( 1 ); /* terminate with an error code */
  24.         }
  25.  
  26.         midx = getmaxx() / 2;
  27.         midy = getmaxy() / 2;
  28.         setcolor ( getmaxcolor() );
  29.  
  30.         /* draw the circle */
  31.         circle ( midx, midy, radius );
  32.  
  33.         /* clean up */
  34.         getch();
  35.         closegraph();
  36.         return 0;
  37. }

Reply to "Draw a circle with a given radius centered on (x, y)"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website