载入中
  • 题目:Koch曲线C程序
  • 作者:佚名
  • 发表日期:十月 02, 2007
  • 浏览:372次
  • 收藏本文
  • 编者导读:#include "graphics.h" #include "math.h" float x=80,y=420; int th=0,L=6; float dtor=3.1415926/180; void koch(int n) { float d; d=L/3^n; if(n=...
  • #include "graphics.h"
    #include "math.h"
    float x=80,y=420;
    int th=0,L=6;
    float dtor=3.1415926/180;
    void koch(int n)
    {
    float d;
    d=L/3^n;
    if(n==0)
      {
      moveto(x,y);
      x+=d*cos(th*dtor);
      y-=d*sin(th*dtor);
      lineto(x,y);
      return;
      }
     koch(n-1);
     th+=60;
     koch(n-1);
     th-=120;
     koch(n-1);
     th+=60;
     koch(n-1);
    }
    main()
    {
     int gdriver=DETECT,gmode;
     initgraph(&gdriver,&gmode,"");
     cleardevice();
     setbkcolor(0);
     setcolor(9);
     line(80,60,560,60);
     getch();
     moveto(80,240);
     lineto(240,240);
     lineto(320,100);
     lineto(400,240);
     lineto(560,240);
     getch();
     settextstyle(2,0,5);
     outtextxy(40,50,"(a)");
     outtextxy(40,230,"(b)");
     outtextxy(40,410,"(c)");
     koch(5);
     getch();
     closegraph();
     cleardevice();
    }
  • 【引用地址】http://www.suanshu.net/test.aspx
  • 【关键字】题目:Koch曲线C程序
载入中
版权申明:非特殊申明,本站文章均系转载自互联网,如果侵犯了你的合法权益,请告知我们,我们会第一时间处理. 要点评这篇文章,请在下面留言
针对这篇文章的评论
  • 评论载入中
    评论载入中...请稍后...

发表您的评论您的评论

用户名: 验证码: 说明:评论并不需要注册.如果您不是本站会员,你可以注册为本站会员. 注意:文章中的链接、内容等需要修改的错误,请用报告错误,以利文档及时修改。
  • 不良评论请用报告管理员,以利管理员及时删除。
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规。
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任。
  • 本站评论管理人员有权保留或删除其管辖评论中的任意内容。
  • 您在本站发表的作品,本站有权在网站内转载或引用。
  • 参与本评论即表明您已经阅读并接受上述条款。

赞助商链接