Mendelbrot Ascii plot
Dec 7, 2014 at 9:07pm UTC
So for CompSci class we have to create an Ascii plot of the mendelbrot set.
I've gotten this far but don't know how to run the actual program. Any help would be great.
Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#include <iostream>
#include <complex>
using namespace std;
int mandelbrotEscapeNumber( complex<double > c);
char mandelbrotEscapeChar( int i );
int main(void )
{
system("pause" );
return (0);
}
//mandelbrot function
int mandelbrotEscapeNumber( complex<double > c){
complex<double > z;
int i = 0;
do {
z = z*z + c;
i++;
if ( i >= 255)
break ;
}while ( abs(z) <= 2.0 );
return (i);
}
char mandelbrotEscapeChar( int i ){
if (i<5)
return ('@' );
if (i<10)
return ('.' );
if (i<50)
return (' ' );
if (i<100)
return ('.' );
if (i<150)
return (' ' );
return ('+' );
}
Topic archived. No new replies allowed.