b2c信息网

您现在的位置是:首页 > 社会热点 > 正文

社会热点

烟花代码编程C语言(c语言烟花代码简单)

hacker2022-06-06 04:42:37社会热点95
本文导读目录:1、求用vc写的模拟烟花效果的源代码2、
本文导读目录:

求用vc写的模拟烟花效果的源代码

关于 vc 里面使用 graphics.h 的问题,你只需要安装 easyx 即可,百度一下吧。另外你可以到百度 easyx 贴吧查找相关资源,官网也有使用演示。

关于图标的问题,你打开我的电脑 - 工具 - 文件夹选项 - 文件类型,然后在里面修改 .c 和 .cpp 的图标即可。

表白烟花代码

天天敲代码的朋友,有没有想过代码也可以变得很酷炫又浪漫?今天就教大家用Python模拟出绽放的烟花,工作之余也可以随时让程序为自己放一场烟花秀。

python炫酷烟花表白源代码

这个有趣的小项目并不复杂,只需一点可视化技巧,100余行Python代码和程序库Tkinter,最后我们就能达到下面这个效果:

学完本教程后,你也能做出这样的烟花秀。

整体概念梳理

我们的整个理念比较简单。

我们这里通过让画面上一个粒子分裂为X数量的粒子来模拟爆炸效果。粒子会发生"膨胀”,意思是它们会以恒速移动且相互之间的角度相等。这样就能让我们以一个向外膨胀的圆圈形式模拟出烟花绽放的画面。经过一定时间后,粒子会进入"自由落体”阶段,也就是由于重力因素它们开始坠落到地面,仿若绽放后熄灭的烟花。

礼花代码

http://www.173at.com/html/daima/20070915/290.html

http://www.qqkj.cn/search/3908.html

http://www.popoho.com/article/QQSkill/html/11947.html

我这里网速比较慢,打不开网页,你自己去看看吧,应该不会错的,希望能够帮到你

c语言放烟花代码

# define PI 3.14

#includegraphics.h

#includestdio.h

#includestdlib.h

#includebios.h

#includemath.h

#includetime.h

#includealloc.h

#includeconio.h

#includedos.h

#includestring.h

void star(int x,int y);

void drawstar();

void Putstar(void);

void starflower();

int main()

{

int gdriver=DETECT;

int gmode=0;

initgraph(gdriver,gmode,"c:\\tc20\\bgi");

drawstar();

starflower();

getch();

closegraph();

return 0;

}

void star(int x,int y)

{

int i,a;

int n=5;

int x1[5],y1[5],x2[5],y2[5];

setcolor(YELLOW);

for(i=0;i5;i++)

{

x1[i]=x+n*cos(i*72*PI/180);

y1[i]=y+n*sin(i*72*PI/180);

x2[i]=x+n/2*cos(i*72*PI/180+PI/5);

y2[i]=y+n/2*sin(i*72*PI/180+PI/5);

}

for(i=0;i5;i++)

{

a=i+1;

if(a4) a=0;

line(x1[i],y1[i],x2[i],y2[i]);

line(x2[i],y2[i],x1[a],y1[a]);

}

}

void Putstar(void)

{

int seed=1858;

int i,dotx,doty,h,w,color,maxcolor;

w=getmaxx();

h=getmaxy();

srand(seed);

for(i=0;i100;++i)

{dotx=i+random(w-1);

doty=1+random(h-1);

color=random(h-1);

setcolor(color);

putpixel(dotx,doty,color);

circle(dotx+1,doty+1,1);

}

srand(seed);

}

void drawstar()

{

int a[]={70,280,230,440,140,110,180,90,500,360};

int b[]={50,27,88,99,100,37,67,98,60,78},i;

setfillstyle(1,14);

for(i=0;i10;i++)

{

star(a[i],b[i]);

floodfill(a[i],b[i],YELLOW);

}

Putstar();

}

void starflower()

{

int i=0,j,n=60,n1=2;

int x=200,y=200,size=100;

int cover=0;

int delay1=20;

int wid,hei;

int px,py;

int color=9;

while(!kbhit())

{

if(isize)

{

for(j=0;jn;j++)

{

px=x+i*cos(j*360/n*PI/180);

py=y+i*sin(j*360/n*PI/180);

putpixel(px,py,rand()%16);

putpixel(px-1,py,color);

putpixel(px,py+1,color);

putpixel(px+1,py-1,YELLOW);

putpixel(px,py-1,YELLOW);

putpixel(px+1,py,RED);

putpixel(px+1,py+1,RED);

}

}

if(isizecoversize)

{

setcolor(BLACK);

circle(x,y,cover++);

delay1=20;

}

if(cover==size)

{

i=0;

x=50+rand()%550;

y=rand()%400;

cover=0;

color=rand()%16;

size=50+rand()%250;

delay1=40;

clearviewport();

drawstar();

}

i+=n1;

delay(delay1);

}

}

关于VC或者MFC编程环境下,烟花绽放程序的C代码

可惜一开始没能画成圆,所以整个过程都是菱形的变换,希望大家多多指教,能够想办法把初始状态就围成一个圆.

#include "stdlib.h"

#include"graphics.h"

main()

{int gd=DETECT,gr,a[8],b[8],x,y,i,j,c;

initgraph(gd,gr,"");

randomize();

for(;!kbhit();)

{x=rand()%500+100; /*随机中心坐标*/

y=rand()%300+100;

a[0]=x; /*各点坐标的计算,我的烟花图形没能是圆的*/

b[0]=y-10;

a[1]=a[0]+5;

a[2]=a[1]+5;

a[3]=a[1];

a[4]=a[0];

a[5]=a[0]-5;

a[6]=a[5]-5;

a[7]=a[6]+5;

for(j=1;j5;j++)

b[j]=b[j-1]+5;

for(j=5;j8;j++)

b[j]=b[j-1]-5;

for(j=0;j6;j++) /*烟花的大小设定*/

{

for(i=0;i8;i++)

{

c=rand()%13+1; /*各点的颜色随机*/

setcolor(c);

circle(a[i],b[i],1);

}

delay(5000);

cleardevice();

b[0]-=10; /*各点的坐标变换*/

a[1]+=5;

b[1]-=5;

a[2]+=10;

a[3]+=5;

b[3]+=5;

b[4]+=10;

a[5]-=5;

b[5]+=5;

a[6]-=10;

a[7]-=5;

b[7]-=5;

}

}

getch();

closegraph();

}

通过C程序来模拟警笛、消防车、以及烟花然后的声音效果。

unsigned freq[]={200,100,200,100,200,100,200,100,200,100,200,100,

200,100,200,100,200,100,200,100,200,100,200,100,200,100,-1};

int main()

{

int i = 0;

for(;freq[i]!=-1;i++)

{

_beep(freq[i],500);

}

return 0;

}

如果要其他音效,自己可以动手改freq里面的数值

电脑的烟花及编程码

就是就是

这方面用c麻烦死了

还是学学flash吧

简单得多

有c的基础

actionscript也不难学

模拟烟花的程序,运行总出错,请c语言大师指点!!!

选项-目录-输出目录-不要设置和initgraph(dr,mode,"d:\\turboc2");

一样就可以正常执行.

Options-Directories-Output

Directory-不要设置和initgraph(dr,mode,"d:\\turboc2");

一样就可以正常执行.

发表评论

评论列表

  • 忿咬喵叽(2022-06-06 16:31:32)回复取消回复

    本文导读目录:1、求用vc写的模拟烟花效果的源代码2、表白烟花代码3、礼花代码4、c语言放烟花代码5、关于VC或者MFC编程环境下,烟花绽放程序的C代码6、通过C程序来模拟警笛、消防车、以及烟花然后的声音效果。7、电脑的烟花及编程码8、模拟