/* Digital Differential Analyzer (DDA) algorithm for drawing a circle. Code from Computer Graphics (SPPU - Second Year - Computer Engineering - Content) repository on KSKA Git: https://git.kska.io/sppu-se-comp-codes/CG */ // BEGINNING OF CODE #include #include using namespace std; int main() { // Taking input for X, Y coordinate and radius of the circle int cordx, cordy, rad; cout<<"Enter X coordinate for the circle:\t"; cin>>cordx; cout<<"Enter Y coordinate for the circle:\t"; cin>>cordy; cout<<"Enter radius for the circle:\t"; cin>>rad; // Logic for octent int gd=DETECT,gm; initgraph(&gd, &gm, NULL); int x,y,p; x=0; y=rad; p=3-(2*rad); do { putpixel(cordx+x, cordy-y, WHITE); putpixel(cordx-x, cordy-y, GREEN); putpixel(cordx+x, cordy+y, YELLOW); putpixel(cordx-x, cordy+y, RED); putpixel(cordx+y, cordy+x, WHITE); putpixel(cordx+y, cordy-x, GREEN); putpixel(cordx-y, cordy+x, YELLOW); putpixel(cordx-y, cordy-x, RED); if (p<0) { p=p+(4*x)+6; } else { p=p+(4*(x-y))+10; y=y-1; } x=x+1; } while(x