| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1198 人关注过本帖
标题:一个叶型程序,大家可以运行试试!
取消只看楼主 加入收藏
流星雨
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:JAVA风暴
等 级:版主
威 望:43
帖 子:1854
专家分:1868
注 册:2004-5-30
结帖率:56.76%
收藏
 问题点数:0 回复次数:0 
一个叶型程序,大家可以运行试试!
#include "math.h" #include <graphics.h> #include <stdlib.h> #include <time.h> void main(void) { int gdriver=DETECT,gmode ; int ran_number ; float a,b,c,d,e,f ; float x,y,x_pre,y_pre ; float disp_x,disp_y ; initgraph(&gdriver,&gmode,"\\tc"); /* setfillstyle(SOLID_FILL,RED);*/ randomize(); setbkcolor(BLUE); setcolor(14); x=y=x_pre=y_pre=0 ; ran_number=90 ; while(kbhit()==0) { ran_number=random(100)+1 ; if(ran_number==1) { a=0 ; b=0 ; c=0 ; d=0.15 ; e=0 ; f=0 ; } else if(ran_number>1&&ran_number<=86) { a=0.87 ; b=0.014 ; c=-0.014 ; d=0.87 ; e=0 ; f=1.6 ; } else if(ran_number>86&&ran_number<=93) { a=0.26 ; b=0.472 ; c=0.772 ; d=0.34 ; e=0 ; f=1.6 ; } else { a=0.28 ; b=0.867 ; c=-0.478 ; d=0.4 ; e=0 ; f=0.44 ; } x=a*x_pre*cos(b)-d*sin(c)*y_pre+e ; y=c*x_pre*sin(b)+d*cos(c)*y_pre+f ; x_pre=x ; y_pre=y ; disp_x=(x+5)*639/12 ; disp_y=350-y*28 ; putpixel((int)disp_x,(int)disp_y,GREEN); } getch(); getch(); closegraph(); }
搜索更多相关主题的帖子: 叶型 运行 
2004-09-05 20:28
快速回复:一个叶型程序,大家可以运行试试!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011491 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved