#include#include #include using namespace std; void MidPoint_Circle(const int& x0, const int& y0, const int& r) { initgraph(800, 640); int d = 1 - r, x = 0, y = r; while (x <= y) { cout << "x=" << x << ",y=" << y << ",d=" << d << endl; putpixel(x + x0, y + y0,RED); putpixel(x + x0, -y + y0,RED); putpixel(-x + x0, y + y0, RED); putpixel(-x + x0, -y + y0, RED); putpixel(y + x0, x + y0, RED); putpixel(y + x0, -x + y0, RED); putpixel(-y + x0, x + y0, RED); putpixel(-y + x0, -x + y0, RED); if (d < 0) { d += (2 * x + 3); x++; } else { d += (2 * x - 2 * y + 5); x++; y--; } } _getch(); closegraph(); } int main(void) { MidPoint_Circle(200,200,10); return 0; }



