#include
#include
#include
#include
#define pi 3.14
void flori(float x0, float y0, float l,float u,int n)
{float xa,ya,xb,yb, xc, yc, x1, y1;
if(n!=1)
{xa=x0+l/2*cos(u);
ya=y0-l/2*sin(u);
xb=xa+l/2*cos(u-pi/3);
yb=ya-l/2*sin(u-pi/3);
xc=xb+l/2*cos(u-pi/3);
yc=yb-l/2*sin(u-pi/3);
flori(x0,y0,l/2,u,n-1);
flori(xa,ya,l/2,u+pi/3,n-1);
flori(xb,yb,l/2,u-pi/3,n-1);
flori(xc,yc,l/2,u,n-1);
}
else
{
x1=x0-l*sin(u);
y1=y0-l*tan(u);
line(x0,y0,x1,y1);
}
}
int main()
{ int n=11;
int gd, gm;
initgraph(&gd, &gm, " ");
initwindow(getmaxwidth(), getmaxheight(),"Flori de gheata");
setcolor(11);
flori(getmaxx()/2,getmaxy()/2,250,5,n);
flori(getmaxx()/2,getmaxy()/2,250,-4.5,n);
setcolor(9);
flori(getmaxx()/2,getmaxy()/2,250,0,n);
flori(getmaxx()/2,getmaxy()/2,250,3,n);
setcolor(WHITE);
flori(getmaxx()/2,getmaxy()/2,50,5,n);
flori(getmaxx()/2,getmaxy()/2,50,-4.5,n);
flori(getmaxx()/2,getmaxy()/2,50,0,n);
flori(getmaxx()/2,getmaxy()/2,50,3,n);
getch();
}
Include ......h> ce anume? ca imi da foarte multe erori (eu am inclus librariile iostream.h,stdio.h,conio.h,stdlib.h...tu ce librarii ai inclus ca sa-ti mearga programu? Multumesc!
AM rezolvat problema...alte programe cu fractali ai?