当前位置: 代码迷 >> C语言 >> 一个叶型程序,大家可以运行试试!
  详细解决方案

一个叶型程序,大家可以运行试试!

热度:345   发布时间:2004-09-05 20:28:00.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(); }
搜索更多相关的解决方案: 叶型  运行  

----------------解决方案--------------------------------------------------------

出现了错误提示。

BGI Error: Graphics not initialized (use 'initgraph') 你用的是什么编译器啊。


----------------解决方案--------------------------------------------------------
tc201
----------------解决方案--------------------------------------------------------
效果不错哦!
----------------解决方案--------------------------------------------------------

顶一下!!


----------------解决方案--------------------------------------------------------

这不就是 Turbo C for Windows 里面的例子代码?

随意粘贴别人代码

小心别人找你算账


----------------解决方案--------------------------------------------------------
老天呀,你们写的程序什么一点注释都没有呀,加点注释好吗
----------------解决方案--------------------------------------------------------

看来你已经比较老手了,有机会交流呀。我的QQ是:191071963

邮箱zhp11@126.com


----------------解决方案--------------------------------------------------------
  学习用trubo c编图形,很难吗?怎么我在tubro c 2.o里老是运行不成功呢?(注:在论坛里抄的一些程序)
----------------解决方案--------------------------------------------------------
不是自己的写的就应该说明出处。不然可就有抄袭的嫌疑了!(这分明是win_tc的范例程序)
----------------解决方案--------------------------------------------------------
  相关解决方案