graphics, sierpinski carpet

hi! i have this project that i have to do... and i really dont know how to do it. it is using graphics, it is about sierpinski carpet



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #include <iostream.h>
 #include <conio.h> 
#include <graphics.h>
 int l, grdriver, grmode, eroare; 
void fractal(int x, int y, int r) 
{if(r>0) {
 fractal(x-r, y+r, r/2); 
fractal(x-r, y-r, r/2); 
fractal(x+r, y-r, r/2);
 fractal(x+r, y+r, r/2); 
bar(x-r/2, y-r/2, x+r/2, y+r/2); } } 
int main() { cout<<"l="; cin>>l;
 grdriver=DETECT; 
initgraph(&grdriver, &grmode,"");
 eroare=graphresult();
 if (eroare==grOk) 
{ setbkcolor(WHITE);
 setfillstyle(SOLID_FILL,RED);
 fractal(getmaxx()/2, getmaxy()/2, l); 
getch(); }
 closegraph(); 
return 0; }



it just stop working, and i dont know why...


please, help me if you can, i really need it. this forum is my last hope
Last edited on
i know, but i really need help with this... i've deleted it now(the other post)

You need to be more specific and not just "it just stop working, and i dont know why..." - what exactly is not working?
the program, when i build it, there is nothing going on and i receive a mesage like : "the program stop working"

I don't use Turbo C so cant personally do a debug trace. Have you stepped through your code with the debugger?
yes, i've done that
there is no kind of error, this is why i dont undersand why it is not working
Are you sure its not related to Turbo C, and not your code?

Sorry I cant be help more, maybe someone else who uses Turbo C can try your code. If it was working, and you haven't changed anything then surely it should still work... that would lead me to believe its the compiler who has some problems.
Topic archived. No new replies allowed.