问题描述
我在绘制带有Curses的Mandelbrot套装时遇到麻烦。我主要看的是本教程:https://www.codingame.com/playgrounds/2358/how-to-plot-the-mandelbrot-set/mandelbrot-set。 即使我遵循他们编写的程序的逻辑,我的屏幕最终也只会输出相同字符的行。有人知道出了什么问题吗?
#include <curses.h>
#include <stdlib.h>
int mandelbrot(int c) {
int z = 0,n = 0;
while (abs(z) <= 2 && n < 100) {
z = z * z + c;
n++;
}
return n;
}
int main() {
initscr();
cbreak();
noecho();
int MAX_Y,MAX_X;
getmaxyx(stdscr,MAX_Y,MAX_X);
for (int bi = 0; bi < MAX_Y; bi++) {
for (int a = 0; a < MAX_X; a++) {
int growth_factor = mandelbrot(a / 10);
if (growth_factor == 100)
mvprintw(bi,a,"#");
else
mvprintw(bi,"*");
}
}
refresh();
getch();
endwin();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)