Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- int escapeSteps (double x0, double y0);
- int main (int argc, char * argv []){
- int row = 0;
- double y = 2;
- while (row <100){
- int col = 0;
- double x = -2;
- while (col < 100){
- if (escapeSteps(x, y) == 255) {
- printf("*");
- } else {
- printf(" ");
- }
- col++;
- x += 0.04;
- }
- printf("\n");
- row++;
- y -= 0.04;
- }
- return EXIT_SUCCESS;
- }
- int escapeSteps (double x0, double y0){
- double x = 0.0;
- double y = 0.0;
- double xtemp;
- int iteration = 0;
- while ( x*x + y*y < 2*2 && iteration < 255) {
- xtemp = x*x - y*y + x0;
- y = 2*x*y + y0;
- x = xtemp;
- iteration++;
- }
- return iteration;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement