0% found this document useful (0 votes)
2 views1 page

bb

This document contains a C program that uses graphics to draw a circle using Bresenham's algorithm. It initializes the graphics mode, defines functions to draw pixels and the circle, and executes the drawing in a loop. Finally, it waits for a key press before closing the graphics window.

Uploaded by

jkboss gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

bb

This document contains a C program that uses graphics to draw a circle using Bresenham's algorithm. It initializes the graphics mode, defines functions to draw pixels and the circle, and executes the drawing in a loop. Finally, it waits for a key press before closing the graphics window.

Uploaded by

jkboss gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>
#include <conio.h>
#include <graphics.h>
#include <dos.h>

void drawCircle(int xc, int yc, int x, int y) {


putpixel(xc + x, yc + y, RED);
putpixel(xc - x, yc + y, RED);
putpixel(xc + x, yc - y, RED);
putpixel(xc - x, yc - y, RED);
putpixel(xc + y, yc + x, RED);
putpixel(xc - y, yc + x, RED);
putpixel(xc + y, yc - x, RED);
putpixel(xc - y, yc - x, RED);
}

void Circlebres(int xc, int yc, int r) {


int x = 0, y = r;
int d = 3 - (2 * r);

drawCircle(xc, yc, x, y);

while (y >= x) {
x++;
if (d > 0) {
y--;
d = d + 4 * (x - y) + 10;
} else {
d = d + 4 * x + 6;
}
drawCircle(xc, yc, x, y);
delay(50);
}
}

void main() {
int xc = 100, yc = 100, r = 50;
int gd = DETECT, gm;

initgraph(&gd, &gm, "C:\\TC\\BGI"); // Initialize graphics


Circlebres(xc, yc, r); // Function call

getch();
closegraph(); // Close graphics mode
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy