User Tools

Site Tools


c:graphics.h:circle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:circle [2024/02/16 01:05] (current)
Line 1: Line 1:
 +===== circle =====
 +
 +
 +====Syntax of circle ==== 
 + <code c>
 +#include <graphics.h>
 +void circle(int x, int y, int radius);
 +  </code>
 +
 +
 +==== Description of circle ==== 
 +<code c>
 +circle draws a circle in the current drawing color with its center at
 +(x,y) and the radius given by radius.
 +The linestyle parameter does not affect arcs, circles, ellipses, or pie
 +slices. Only the thickness parameter is used.
 +If your circles are not perfectly round, adjust the aspect ratio.
 +</code>
 +
 +
 +==== Example of circle ====
 +<code c>
 +/* circle example */
 +
 +#include <graphics.h>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <conio.h>
 +
 +int main(void)
 +{
 +   /* request autodetection */
 +   int gdriver = DETECT, gmode, errorcode;
 +   int midx, midy, radius = 100;
 +
 +   /* initialize graphics and local variables */
 +   initgraph(&gdriver, &gmode, "");
 +
 +   /* read result of initialization */
 +   errorcode = graphresult();
 +   if (errorcode != grOk) {   /* an error occurred */
 +printf("Graphics error: %s\n", grapherrormsg(errorcode));
 +
 +printf("Press any key to halt:");
 +getch();
 +exit(1);   /* terminate with an error code */
 +   }
 +
 +   midx = getmaxx() / 2;
 +   midy = getmaxy() / 2;
 +   setcolor(getmaxcolor());
 +
 +   /* draw the circle */
 +   circle(midx, midy, radius);
 +   /* clean up */
 +   getch();
 +   closegraph();
 +   return 0;
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[arc]]
 +[[ellipse]]
 +[[fillellipse]]
 +[[getaspectratio]]
 +[[sector]]
 +[[setaspectratio]]
 +
 +
 +===== output of circle example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/graphics.h/circle.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz