#include "graphics.h"
#include "math.h"
void MSB(cxmin,cxmax,cymin,cymax,nmax)
float cxmin,cxmax,cymin,cymax;
int nmax;
{
float sx=500.0,sy=400.0;
float cx,cy,x,y,xx,yy,dx,dy,z,L=4.0;
int i,j,n,color;
dx=(cxmax-cxmin)/sx;
dy=(cymax-cymin)/sy;
for(i=0;i<sx;i++)
{
cx=cxmin+i*dx;
for(j=0;j<sy;j++)
{
cy=cymin+j*dy;
x=cx;
y=cy;
for(n=0;n<nmax;n++)
{
xx=x*x-y*y+0.3901235;
yy=2*x*y+0.3506173;
z=xx+yy;
if(fabs(z)>L)break;
x=xx;
y=yy;
}
color=n%16;
putpixel(i+50,j+40,color);
}
}
} main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
MSB(-2.25,1.75,-1.8,1.5,100);
getch();
}