1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<complex.h> #include<math.h> #include<stdlib.h> 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(); } |

### Blog post

Article from my blog

## Recent Comments