Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<graphics.h>
- #include<iostream.h>
- #include<conio.h>
- #include<math.h>
- void main()
- {
- int gd=DETECT,gm,x,y,r,p;
- initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
- cout<<"Enter the radius of the circle:";
- cin>>r;
- x=0;
- y=r;
- p=1-r;
- do
- {
- putpixel(100+x,100+y,15);
- putpixel(100+x,100-y,15);
- putpixel(100+y,100+x,15);
- putpixel(100+y,100-x,15);
- putpixel(100-x,100+y,15);
- putpixel(100-x,100-y,15);
- putpixel(100-y,100+x,15);
- putpixel(100-y,100-x,15);
- if(p<0)
- {
- x++;
- p=p+2*x+3;
- }
- else
- {
- x++;
- y--;
- p=p+2*(x-y)+5;
- }
- }
- while(x<y);
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement