#include #include #include #include void common(int xc,int yc,int x, int y) { putpixel(xc+x,yc+y,2); putpixel(xc-x,yc+y,3); putpixel(xc-x,yc-y,4); putpixel(xc+x,yc-y,5); putpixel(xc+y,yc+x,6); putpixel(xc-y,yc+x,7); putpixel(xc-y,yc-x,8); putpixel(xc+y,yc-x,9); } void main() { int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ struct point { int x,y; } p1; int radius,x,y,i; float d; printf("give me the center--->"); scanf("%d %d",&p1.x,&p1.y); printf("give me the radius -->"); scanf("%d",&radius); getche(); GraphDriver = DETECT; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); /* just increasing p1 - p2 */ setcolor(14); circle(p1.x,p1.y,radius); getche(); x=0; y=radius; d=5.0/4-radius; while (x<=y) { common(p1.x,p1.y,x,y); if (d<0) d=d+2*x+3; else { d=d+2*(x-y)+5; y--; } x++; } getche(); closegraph(); /* Return the system to text mode */ }