Q:

defining a circle by algorithm

I've got a 100px*100px image 
Gotta draw some filled circles with random position and radius.the problem is not the random stuff.
I just don't know the algorithm to define a circle with position(x,y) and radius(r) on pixels.

A:

Got an answer for it:
Midpoint circle algorithm
void drawcircle(int x0, int y0, int radius)
{
int x = radius;
int y = 0;
int err = 0;

while (x >= y)
{
    putpixel(x0 + x, y0 + y);
    putpixel(x0 + y, y0 + x);
    putpixel(x0 - y, y0 + x);
    putpixel(x0 - x, y0 + y);
    putpixel(x0 - x, y0 - y);
    putpixel(x0 - y, y0 - x);
    putpixel(x0 + y, y0 - x);
    putpixel(x0 + x, y0 - y);

    if (err <= 0)
    {
        y += 1;
        err += 2*y + 1;
    }
    if (err > 0)
    {
        x -= 1;
        err -= 2*x + 1;
    }
}
}

