#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,p,x,y,i; 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; p=3-2*radius; while (x<=y) { common(p1.x,p1.y,x,y); if (p<0) p=p+4*x+6; else { p=p+4*(x-y)+10; y--; } x++; } getche(); closegraph(); /* Return the system to text mode */ }