#include "stdio.h"
#include "conio.h"
#include "graphics.h"
#include "math.h"
#include "dos.h"
void brsc (int cx,int cy, int r)
{
int x,y,d;
d = 3 - 2 * r;
x = 0;
y = r;
do
{
putpixel (x+cx,y+cy,15);
putpixel (y+cx,x+cy,2);
putpixel (y+cx,-x+cy,4);
putpixel (x+cx,-y+cy,6);
putpixel (-x+cx,-y+cy,8);
putpixel (-y+cx,-x+cy,10);
putpixel (-y+cx,x+cy,12);
putpixel (-x+cx,y+cy,14);
delay (100);
if (d < 0)
{
d = d + 4 * x + 6;
}
else
{
d = d + 4 * (x-y) + 10;
y = y - 1;
}
x = x + 1;
}
while (x < y);
}
void main ()
{
int gd,gm;
int x,y,r;
clrscr ();
printf ("Enter the coordinates: ");
scanf ("%d%d",&x,&y);
printf ("Enter the radius: ");
scanf ("%d",&r);
detectgraph (&gd,&gm);
initgraph (&gd,&gm,"c:\\TC\\BGI");
brsc (x,y,r);
getch ();
closegraph ();
}
0 comments:
Post a Comment