日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python画烟花的代码_电脑怎么用代码画烟花?

發(fā)布時(shí)間:2024/9/27 python 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python画烟花的代码_电脑怎么用代码画烟花? 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

內(nèi)個(gè),我是化學(xué)專業(yè)的……

回憶了一下,框架是這個(gè):

#include "stdlib.h"

#include "graphics.h"

#include "stdio.h"

#include "math.h"

#include "conio.h "

#define PI 3.1425926

main()

{

int gdriver=DETECT,gmode,errorcode;

int a[10],b[10],x,y,c,r,i,j,t;

double rad = 0.0;

/* initialize graphics and local variables */

initgraph(&gdriver , &gmode ,"");

/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

{

printf("Graphics error : %s/n",grapherrormsg(errorcode));

printf("Please any key to halt:");

getch();

exit(1); /* terminate with an error code */

}

randomize();

for(;!kbhit();)

{

x=rand()%500+100; /*隨機(jī)中心坐標(biāo)*/

y=rand()%300+100;

for(r = 0 ;r <= 8 ; r++ ) /*煙花的大小設(shè)定*/

{

for(i = 0,rad = 0.0 ; rad < 2*PI; rad += 0.78 ) /*設(shè)定坐標(biāo)*/

{

a[i++] = x + (int)r *10* cos(rad);

b[ i ] = y + (int)r *10* sin(rad);

}

t = i;

for(i=1;i

{

c=rand()%13+1; /*各點(diǎn)的顏色隨機(jī)*/

setcolor(c); /*功能:將當(dāng)前圖形屏幕的當(dāng)前筆畫顏色置為color.*/

circle(a[i],b[i],1);/* a[i],b[i] 為圓心 1 為半徑 畫圓 */

}

delay(10000);

delay(10000);

cleardevice();

函數(shù)名: cleardevice

功 能: 清除圖形屏幕

用 法: void far cleardevice(void);

}

}

getch();

closegraph();

函數(shù)名: closegraph

功 能: 關(guān)閉圖形系統(tǒng)

用 法: void far closegraph(void);

}

總結(jié)

以上是生活随笔為你收集整理的python画烟花的代码_电脑怎么用代码画烟花?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。