graphics, sierpinski carpet

Apr 27, 2014 at 10:22am
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 Apr 27, 2014 at 10:38am
Apr 27, 2014 at 10:28am
Apr 27, 2014 at 10:31am
i know, but i really need help with this... i've deleted it now(the other post)
Apr 27, 2014 at 10:33am

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

I don't use Turbo C so cant personally do a debug trace. Have you stepped through your code with the debugger?
Apr 27, 2014 at 10:49am
yes, i've done that
Apr 27, 2014 at 10:53am
there is no kind of error, this is why i dont undersand why it is not working
Apr 27, 2014 at 11:14am
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.