```
#include
#include
#include
#include
#include
#include
void main()
{
int x1,y1,x,y,r,p,gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
errorcode=graphresult();
if(errorcode!=grOk)
{
cout << "graphics error is: %s" << grapherrormsg(errorcode);
cout << "hit a key to halt" ;
getch();
exit(1);
}
cleardevice();
cout << "enter the value of x1,y1,r" << endl;
cin >>x1>>y1>>r;
x=0;
y=r;
p=3 - 2 * r;
while(x<=y)
{
putpixel(x1+x,y1+y,2);
putpixel(x1-x,y1+y,2);
putpixel(x1+x,y1-y,2);
putpixel(x1-x,y1-y,2);
putpixel(x1+y,y1+x,2);
putpixel(x1-y,y1+x,2);
putpixel(x1+y,y1-x,2);
putpixel(x1-y,y1-x,2);
if(p<0)
p+=4* x++ +6;
else
p+=4* (x++-y--) +10;
}
getch();
}
```
</div>
Leave a comment