circle
raw OCR
Draws a circle of the given radius with its center at ix,y).
Defined in header <graphics.h>
Syntax
#include <graphics.h>
void far circle(int x, int y, int radius);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
circle draws a circle in the current drawing color with its center at (x,}/) 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.
Return value
None.
See also
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(&gdriyer, &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:");
getchO ;
exit(l); /* terminate with an error code */
midx = getmaxxO / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor 0);
/* draw the circle */
circle(midx, midy, radius);
/* clean up */
getchO ;
closegraphO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/graphics.h/circle/
· short form /3.1/circle/