c语言表白浪漫烟花效果代码复制(用c语言编写动态烟花表白)
c语言编程烟花代码简单
c语言编程烟花代码简单如下:
#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; /*随机中心坐标*/
y=rand()%300+100;
for(r = 0 ;r = 8 ; r++? )? ? /*烟花的大小设定*/
{
for(i = 0,rad = 0.0 ; rad 2*PI; rad += 0.78 )? /*设定坐标*/
{
a[i++] = x + (int)r *10* cos(rad);
b[ i ] = y + (int)r *10* sin(rad);
}
t = i;
for(i=1;it;i++)
{
c=rand()%13+1; /*各点的颜色随机*/
setcolor(c);? ? ? ?/*功能:将当前图形屏幕的当前笔画颜色置为color.*/
circle(a[i],b[i],1);/* a[i],b[i] 为圆心 1 为半径 画圆 */
}
delay(10000);
delay(10000);
cleardevice();
函数名: cleardevice? ? ? ? ?
功? 能: 清除图形屏幕?
用? 法: void far cleardevice(void);
}
}
getch();
closegraph();
函数名: closegraph
功? 能: 关闭图形系统
用? 法: void far closegraph(void);
}
初始化烟花参数
void Init( int i )
{
// 分别为:烟花中心到图片边缘的最远距离、烟花中心到图片左上角的距离 (x、y) 两个分量
int r[13] = { 120, 120, 155, 123, 130, 147, 138, 138, 130, 135, 140, 132, 155 };
int x[13] = { 120, 120, 110, 117, 110, 93, 102, 102, 110, 105, 100, 108, 110 };
int y[13] = { 120, 120, 85, 118, 120, 103, 105, 110, 110, 120, 120, 104, 85 };
/**** 初始化烟花 *****/
Fire[i].x = 0; // 烟花中心坐标
Fire[i].y = 0;
Fire[i].width = 240; // 图片宽
Fire[i].height = 240; // 图片高
Fire[i].max_r = r[i]; // 最大半径
Fire[i].cen_x = x[i]; // 中心距左上角距离
Fire[i].cen_y = y[i];
Fire[i].show = false; // 是否绽放
Fire[i].dt = 5; // 绽放时间间隔
Fire[i].t1 = timeGetTime();
Fire[i].r = 0; // 从 0 开始绽放
/**** 初始化烟花弹 *****/
Jet[i].x = -240; // 烟花弹左上角坐标
Jet[i].y = -240;
Jet[i].hx = -240; // 烟花弹发射最高点坐标
Jet[i].hy = -240;
Jet[i].height = 0; // 发射高度
Jet[i].t1 = timeGetTime();
Jet[i].dt = rand() % 10; // 发射速度时间间隔
Jet[i].n = 0; // 烟花弹闪烁图片下标
Jet[i].shoot = false; // 是否发射
}

c语言放烟花代码
# -*- coding: utf-8 -*-import math, random,timeimport threadingimport tkinter as tkimport re uuidFireworks=[]maxFireworks=8height,width=600,600class firework(object):def __init__(self,color,speed,width,height):=uuid.uuid1()self.radius=random.randint(2,4) ~4像素self.color=color self.speed=speed .5-3.5秒self.status=0 ,status=0;爆炸后,status=1;当status100时,烟花的生命期终止self.nParticle=random.randint(20,30) self.center=[random.randint(0,width-1),random.randint(0,height-1)] self.oneParticle=[] (100%状态时)self.rotTheta=random.uniform(0,2*math.pi) :x=a*cos(theta),y=b*sin(theta)=[a,b]
2022年跨年烟花代码可复制
烟花代码如下:
package love;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.net.URL;
import java.util.Random;
烟花
@author enjoy
@SuppressWarnings("serial")
public class Q extends Applet implements Runnable
public int speed, variability, Max_Number, Max_Energy, Max_Patch,
Max_Length, G;
public String sound;
private int width, height;
private Thread thread = null;
private BeaClassDemo bcd[];
public void init()? ? ? ? ? ? ? ? ? ? ?
int i;
this.setSize(1900, 900);
width = getSize().width - 1;
height = getSize().height - 1;
speed = 1;??????????????????????? // 烟花绽放的速度
variability = 10;
Max_Number = 980;??????????????????? // 可发出烟花的最大数目
Max_Energy = width + 50;
Max_Patch = 90;??????????????????? // 最大的斑点数
Max_Length = 90;??????????????????? // 斑点的最大距离
G = 150;??????????????????????????? // 向地面弯曲的力度
bcd = new BeaClassDemo[Max_Number];
for (i = 0; i Max_Number; i++)
bcd[i] = new BeaClassDemo(width, height, G);
}
public void start() {
if (thread == null) {
thread = new Thread(this);
thread.start();
}
}
@SuppressWarnings("deprecation")
public void stop() {
if (thread != null) {
thread.stop();
thread = null;
}
}
@SuppressWarnings({ "unused", "static-access" })
public void run() {
int i;
int E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4 + 1;
int P = (int) (Math.random() * Max_Patch * 3 / 4)??? // 烟花的斑点数
+ Max_Patch / 4 + 1;
int L = (int) (Math.random() * Max_Length * 3 / 4)??? // 烟花可发射出的距离
+ Max_Length / 4 + 1;
long S = (long) (Math.random() * 10000);
boolean sleep;
Graphics g = getGraphics();
URL u = null;
while (true) {
try {
thread.sleep(1000 / speed);
catch (InterruptedException x) {
sleep = true;
for (i = 0; i Max_Number; i++)
sleep = sleep bcd[i].sleep;
if (sleep Math.random() * 100 variability) {
E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4
+ 1;
P = (int) (Math.random() * Max_Patch * 3 / 4) + Max_Patch / 4
+ 1;
L = (int) (Math.random() * Max_Length * 3 / 4) + Max_Length / 4
+ 1;
S = (long) (Math.random() * 10000);
for (i = 0; i Max_Number; i++) {
if (bcd[i].sleep Math.random() * Max_Number * L 1)
bcd[i].init(E, P, L, S);
bcd[i].start();
bcd[i].show(g);
public void paint(Graphics g)? ? ? ? ? ? ? ? ?
g.setColor(Color.black);
g.fillRect(0, 0, width + 1, height + 1);
class BeaClassDemo
public boolean sleep = true;
private int energy, patch, length, width, height, G, Xx, Xy, Ex[], Ey[], x,
y, Red, Blue, Green, t;
private Random random;
public BeaClassDemo(int a, int b, int g)? ? ? ?
width = a;
height = b;
G = g;
public void init(int e, int p, int l, long seed)?
int i;
energy = e;
patch = p;
length = l;
// 创建一个带种子的随机数生成器
random = new Random(seed);
Ex = new int[patch];
Ey = new int[patch];
Red = (int) (random.nextDouble() * 128) + 128;
Blue = (int) (random.nextDouble() * 128) + 128;
Green = (int) (random.nextDouble() * 128) + 128;
Xx = (int) (Math.random() * width / 2) + width / 4;
Xy = (int) (Math.random() * height / 2) + height / 4;
for (i = 0; i patch; i++) {
Ex[i] = (int) (Math.random() * energy) - energy / 2;
Ey[i] = (int) (Math.random() * energy * 7 / 8) - energy / 8;
public void start
t = 0;
sleep = false;
public void show(Graphics g)? ? ?
if (!sleep)??????????????????
if (t length)
int i, c;
double s;
Color color;
c = (int) (random.nextDouble() * 64) - 32 + Red;
if (c = 0 c 256)
Red = c;
c = (int) (random.nextDouble() * 64) - 32 + Blue;
if (c = 0 c 256)
Blue = c;
c = (int) (random.nextDouble() * 64) - 32 + Green;
if (c = 0 c 256)
Green = c;
color = new Color(Red, Blue, Green);
for (i = 0; i patch; i++)
s = (double) t / 100;
x = (int) (Ex[i] * s);
y = (int) (Ey[i] * s - G * s * s);
g.setColor(color);
g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);
if (t = length / 2)
int j;
for (j = 0; j 2; j++)
s = (double) ((t - length / 2) * 2 + j) / 100;
x = (int) (Ex[i] * s);
y = (int) (Ey[i] * s - G * s * s);
g.setColor(Color.black);
g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);
常用的编程语言。
编程语言一:C语言
C语言是世界上最流行、使用最广泛的高级程序设计语言之一。在操作系统和系统使用程序以及需要对硬件进行操作的场合,用C语言明显优于其它高级语言,许多大型应用软件都是用C语言编写的。
编程语言二:java
Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台(即JavaSE, JavaEE, JavaME)的总称。
编程语言三:c++
C++这个词在中国大陆的程序员圈子中通常被读做“C加加”,而西方的程序员通常读做“C plus plus" , "CPP”。 它是一种使用非常广泛的计算机编程语言。C++是一种静态数据类型检查的、支持多重编程范式的通用程序设计语言。
表白代码大全可复制免费
表白代码大全可复制免费
表白代码大全可复制免费,用代码表白是一件非常浪漫的事情,只需要短短的一行代码,就可以制作生活中的惊喜和小浪漫,但是设置代码是需要技巧的,以下分享表白代码大全可复制免费。
表白代码大全可复制免费1
1.发送xoxO(会出现满屏亲亲)
2.发送mi manchi(会出现满屏小星星)
3.发送ohh(翻译:留在我身边)
4.发送ch will mit dir S wim(翻译:我想和你在一起)
5.发送Voce e meu bebe(翻译:你是我的宝贝)
6.发送 RUYDUAautrinuU(翻译我只喜欢你)
7.发送 love at first sight(翻译:—见钟情)
8.发送We will be happy(我们会幸福)
9.发送missu(会出现星星雨)
10.发送u621u7231u460(翻译:爱你)
11.发送u5728u4e0Ou8d7Nu5427(翻译在一起)
12.发送Milji pouze jednu osobu, ta osoba jste vy.我只爱一个人,那个人就是你)
13.发送 yax you(翻译我跟你说)发送yyyax you翻译我喜欢你)发送 yox you!(我爱死你了)
14.n 55 iw!(倒过来是i miss you我想你。)
15.我想要两颗西柚("1 wanttoseeyou"我想要见你)
16.962464(用九宫格输入试试)
17.Mg+Znso4==MgSo4+zn(你的镁夺走了我的锌)
18.Te echo de menos(微信翻译:我想你)
19.双木非林田下有心(相思)
20.n.nggui(倒过来看就是ineedyoy我需要你)
表白代码大全可复制免费2
程序员的表白代码
第一条语言:Java代码翻译:直到死之前,每天爱你多一点代码:while(lifeend){love++;}
第二条语言:C语言代码翻译:IcannotsayHellototheWorldwithoutu.代码:#incldestdio.hintmain(){printf(HelloWorldn);retrn0;}//IcannotsayHellototheWorldwithoutu.
第三条语言:python代码翻译:山无陵,江水为竭,冬雷震震,夏雨雪,天地合,乃敢与君绝!代码:if(mountain.arris==None):if(river.water==None):if(winter.thunder==True):if(summer.snow==
True):if(sky.height==ground.height):i.withyou=Falseelse:i.withyou=True.
第四条语言:Erlang代码代码翻译:深圳相遇,至死不渝代码:-module(you_and_me).-export([start/1]).-record(person,{name,address,status}).start(Name)-one_world(Name).one_world(Name)keep_to_love_you(Person).say_goodbye(Person)-io:format(~p:seeyounextworld!~n,[Person#person.name]).see_you_next_world(Name)-one_world(Name).
第五条语言:Java语言代码翻译:爱你到天荒地老代码:while(!world.destroy){System.out.println(iloveyou);}
表白代码大全可复制免费3
第一条
语言:Java
代码翻译:
直到死之前,每天爱你多一点
代码:
while (life end) {
love++;
}
// I can not say Hello to the World without u.
第二条
语言:python
代码翻译:
山无陵, 江水为竭, 冬雷震震, 夏雨雪, 天地合, 乃敢与君绝!
代码:
if(mountain.arris==None):
if(river.water==None):
if(winter.thunder==True):
if(summer.snow==True):
if(sky.height==ground.height):
i.withyou=False
else:
i.withyou=True
one_world(Name).
第三条
语言:Java语言
代码翻译:
爱你到天荒地老
代码:
while(!world.destroy){
System.out.println("i love you");
}
第四 条
语言:C语言
代码翻译:
两隔的`世界;
无名的信件;
短暂的停留;
长久的记忆;
说这么多,只是想说:我想你了。
代码:
#include
int main()
{
double world;
unsigned letter;
short stay;
long memories;
printf("I miss you. ");
return 0;
}
简单的代码表白
1、浏览器标签法
这个先用不到代码,但却十分简单实用的,首先早一步到办公室,或者趁表白对象不注意的时候在她的电脑上安装chrome浏览器,设置成默认的浏览器,把各项的同步功能打开就可以了。然后选择一个合适的时机,在你的电脑上登录账号,然后标签栏添加你想说的话,例如下图这样:
然后标签就自动同步到表白对象的浏览器上了。
2、两个按键组合成I LOVE U
这个简单的功能是利用的网页查找的功能,在网页中复制下这段文字,
然后crtrl+f,在输入框中输入9,然后回车,看下效果:
3、Python表白代码
心型和圆形椭圆的代码类似,都是由X,Y上的点构成的曲线,确定出一个表达式expression,然后就是两个for循环(for y in range;for x in range),然后逐行逐列的开始就行了。
当然有点太单调,我们可以这样操作一下,让他动起来,像这样
print('\n'.join([''.join([('Love'[(x-y) % len('Love')] if ((x0.05)2+(y0.1)2-1)3-(x0.05)2(y0.1)*3 = 0 else ' ') for x in range(-30, 30)]) for y in range(30, -30, -1)]))
当然还能替换表情,这个代码就不放了,需要的直接跟我要就行。
4、炫酷一点的
C语言诠释爱——为TA写下心中情,生成程序传给TA,TA点开程序就懂你。
这个开始的时候会展示出表白对象的名字,接着就是最重要的烟花部分,为了让烟花显得更加真实,需要附加重力效果和空气阻力效果,源代码图如下
如果需要源码的留下邮乡就可以了。
5、恶搞一点的
这个适合关系已经不错的那种了,看看效果
源码直接发
c语言浪漫代码
#include stdio.h
int main()
{
int i, j, k, l, m;
char c = '*'; //ASCII码里面 3 就是一个字符小爱心
for (i = 1; i = 5; i++)
printf("\n"); //开头空出5行
for (i = 1; i = 4; i++)
{ //前3行中间有空隙分开来写
for (j = 1; j = 32 - 2 * i; j++)
printf(" "); //左边的空格,每下一行左边的空格比上一行少2个 //8*n-2*i
for (k = 1; k = 4 * i - 2; k++)
printf("%c", c); //输出左半部分字符小爱心
for (l = 1; l = 17 - 4 * i; l++)
printf(" "); //中间的空格,每下一行的空格比上一行少4个
for (m = 1; m = 4 * i - 2; m++)
printf("%c", c); //输出右半部分字符小爱心
printf("\n"); //每一行输出完毕换行
}
for (i = 1; i = 3; i++)
{ //下3行中间没有空格
for (j = 1; j = 22 + 1; j++)
printf(" "); //左边的空格 //8*(n-1)+1
for (k = 1; k = 31; k++)
printf("%c", c); //输出字符小爱心
printf("\n"); //每一行输出完毕换行
}
for (i = 7; i = 1; i--)
{ //下7行
for (j = 1; j = 38 - 2 * i; j++)
printf(" "); //左边的空格,每下一行左边的空格比上一行少2个//8*(n+1)-2*i
for (k = 1; k = 4 * i + 1; k++)
printf("%c", c); //每下一行的字符小爱心比上一行少4个(这个循环是i--)
printf("\n"); //每一行输出完毕换行
}
for (i = 1; i = 38; i++)
printf(" "); //最后一行左边的空格
printf("%c", c); //最后一个字符小爱心
for (i = 1; i = 5; i++)
printf("\n"); //最后空出5行
return 0;
}