zoukankan      html  css  js  c++  java
  • Mandelbrot图像

     

    图片

     图片

     using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConsoleApplication3
    {
        class Program
        {
            static void Main(string[] args)
            {
                double realcoord, imagcoord;
                double realtemp, imagtemp, realtemp2, arg;
                int iterations;
                for (imagcoord = 1.2; imagcoord >= -1.2; imagcoord -= 0.05)
                {
                    for (realcoord = -0.6; realcoord <= 1.77; realcoord += 0.03)
                    {
                        iterations = 0;
                        realtemp = realcoord;
                        imagtemp = imagcoord;
                        arg = (realcoord * realcoord) + (imagcoord * imagcoord);
                        while ((arg < 4) && (iterations < 40))
                        {
                            realtemp2 = (realtemp * realtemp) - (imagtemp * imagtemp) - realcoord;
                            imagtemp = (2 * realtemp * imagtemp) - imagcoord;
                            realtemp = realtemp2;
                            arg = (imagtemp * imagtemp) + (realtemp * realtemp);
                            iterations += 1;
                        }
                        switch (iterations % 4)
                        {
                            case 0:
                                Console.Write(".");
                                break;
                            case 1:
                                Console.Write("o");
                                break;
                            case 2:
                                Console.Write("O");
                                break;
                            case 3:
                                Console.Write("@");
                                break;
                        }
                    }
                    Console.Write(" ");
                }
                Console.ReadKey();

             }
        }
    }

  • 相关阅读:
    checkbox 实现单选效果(html)
    HDU-6850 Game
    牛客练习赛29----F 算式子
    牛客多校第二场 B Boundary
    D. Omkar and Circle
    【洛谷】P3306 [SDOI2013]---- 随机数生成器
    二次剩余
    【洛谷】--P2704 [NOI2001]炮兵阵地
    【洛谷】4310 绝世好题
    快速排序
  • 原文地址:https://www.cnblogs.com/zzkgis/p/3742586.html
Copyright © 2011-2022 走看看