Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<graphics.h>
- int main()
- {
- int gd=DETECT,gm;
- initgraph (&gd,&gm,"");
- int x, y,a,b, r, p;
- printf("Enter the mid points (x,y) and radius: \n");
- scanf("%d %d %d", &a, &b, &r);
- x=0;
- y = r;
- p = 1-r;
- while (x<y)
- {
- if (p <0)
- {
- x++;
- p = p + (2*x) + 1;
- printf("(%d,%d)\n", x, y);
- }
- else
- {
- x++;
- y--;
- p = p + 2*(x-y) +1;
- printf("(%d,%d)\n", x, y);
- }
- putpixel(x+a , y+b,WHITE);
- putpixel(-(x)+a , y+b,WHITE);
- putpixel(x+a , -(y)+b,WHITE);
- putpixel(-(x)+a , -(y)+b,WHITE);
- putpixel(y+a, x+b ,WHITE);
- putpixel(-(y)+a,x+b , WHITE);
- putpixel( y+a,(-x)+b ,WHITE);
- putpixel((-y)+a,(-x)+b , WHITE);
- }
- getch();
- closegraph();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement