求助,画SIERPINSKI CARPET
我完全不懂编程,但现在急需画SIERPINSKI CARPET在网上看到这个程序// sierpinski.c
// draw_sierpinski_carpet(int dim) that prints the Sierpiński carpet ofdimension dim
// PRE: dim is a positive number and apower of 3
// POST: void
void draw_sierpinski_carpet(int dim){
int i,j,d;
for (i = 0; i < dim; i++){
for (j = 0; j < dim;j++){
for (d = dim/3; d; d/=3)
if ((i%(d*3))/d == 1&& (j%(d*3))/d == 1)
break;
printf(d ? " " : "**");
}
printf("\n");
}
}
用VC6和CODEBLOCKS都不能运行,是不是这个程序太老,需要修改,请大家帮忙,告诉我如何运行这个程序?