日韩精品亚洲精品中文字幕乱伦AV|曰韩区二区三区日韩中文字幕五码|ady99久久人人看人人摸人人|动漫一区二区黄99精品视频在线|AV片在线观看亚洲中文国产精品|伦乱在线VA欧美性爱一二区|亚洲无码mv91热色视频|激情六月综合欧美精品中文

當(dāng)前位置:首頁(yè) > 網(wǎng)站建設(shè) > 正文內(nèi)容

c語(yǔ)言煙花簡(jiǎn)單版(c語(yǔ)言編程愛心代碼)

網(wǎng)站建設(shè)2年前 (2023-02-23)1271

本篇文章給大家談?wù)刢語(yǔ)言煙花簡(jiǎn)單版,以及c語(yǔ)言編程愛心代碼對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。

本文目錄一覽:

c語(yǔ)言放煙花代碼

#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;it;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);

}

擴(kuò)展資料

C語(yǔ)言:表白顯示(多彩小心心)

#include stdio.h

#include math.h

#include stdlib.h

#define I 20

#define R 340

#include string.h

int main()

{

char answer[10];

printf("遇到你\n我才發(fā)現(xiàn)\n曾經(jīng)所有的條件\n似乎都成了我等你的借口\n\n");

printf("我對(duì)你的感情已經(jīng)決堤\n所以\n請(qǐng)?jiān)试S我,從今往后映入你\n明媚的眼\n");

printf("我\n想和你\n耳鬢廝磨,相濡以沫!");

printf("答應(yīng)我吧!\n輸入yes,你可以看到我的真心\n");

scanf("%s", answer);

float y, x, z, f;

for (y = 1.5f; y -1.5f; y -= 0.1f)

{

for (x = -1.5f; x 1.5f; x += 0.05f)

{

z = x * x + y * y - 1;

f = z * z*z - x * x*y*y*y;

putchar(f = 0.0f ? "*********"[(int)(f*-8.0f)] : ' ');

}

putchar('\n');

}

long time;

for ()

{

system("color a");

for (time = 0; time99999999; time++);

system("color b");

for (time = 0; time99999999; time++);

system("color c");

for (time = 0; time99999999; time++);

system("color d");

for (time = 0; time99999999; time++);

system("color e");

for (time = 0; time99999999; time++);

system("color f");

for (time = 0; time99999999; time++);

system("color 0");

for (time = 0; time99999999; time++);

system("color 1");

for (time = 0; time99999999; time++);

system("color 2");

for (time = 0; time99999999; time++);

system("color 3");

for (time = 0; time99999999; time++);

system("color 4");

for (time = 0; time99999999; time++);

system("color 5");

for (time = 0; time99999999; time++);

system("color 6");

for (time = 0; time99999999; time++);

system("color 7");

for (time = 0; time99999999; time++);

system("color 8");

for (time = 0; time99999999; time++);

system("color 9");

}

getchar();

return 0;

}

2022年跨年煙花代碼可復(fù)制

煙花代碼如下:

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;??????????????????? // 可發(fā)出煙花的最大數(shù)目

Max_Energy = width + 50;

Max_Patch = 90;??????????????????? // 最大的斑點(diǎn)數(shù)

Max_Length = 90;??????????????????? // 斑點(diǎn)的最大距離

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)??? // 煙花的斑點(diǎn)數(shù)

+ Max_Patch / 4 + 1;

int L = (int) (Math.random() * Max_Length * 3 / 4)??? // 煙花可發(fā)射出的距離

+ 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;

// 創(chuàng)建一個(gè)帶種子的隨機(jī)數(shù)生成器

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);

}

}

}

t++;

} else {

sleep = true;

}

}

}

常用的編程語(yǔ)言。

編程語(yǔ)言一:C語(yǔ)言

C語(yǔ)言是世界上最流行、使用最廣泛的高級(jí)程序設(shè)計(jì)語(yǔ)言之一。在操作系統(tǒng)和系統(tǒng)使用程序以及需要對(duì)硬件進(jìn)行操作的場(chǎng)合,用C語(yǔ)言明顯優(yōu)于其它高級(jí)語(yǔ)言,許多大型應(yīng)用軟件都是用C語(yǔ)言編寫的。

編程語(yǔ)言二:java

Java是一種可以撰寫跨平臺(tái)應(yīng)用軟件的面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言,是由Sun Microsystems公司于1995年5月推出的Java程序設(shè)計(jì)語(yǔ)言和Java平臺(tái)(即JavaSE, JavaEE, JavaME)的總稱。

編程語(yǔ)言三:c++

C++這個(gè)詞在中國(guó)大陸的程序員圈子中通常被讀做“C加加”,而西方的程序員通常讀做“C plus plus" , "CPP”。 它是一種使用非常廣泛的計(jì)算機(jī)編程語(yǔ)言。C++是一種靜態(tài)數(shù)據(jù)類型檢查的、支持多重編程范式的通用程序設(shè)計(jì)語(yǔ)言。

c語(yǔ)言編程煙花代碼簡(jiǎn)單

c語(yǔ)言編程煙花代碼簡(jiǎn)單如下:

#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;it;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);

}

初始化煙花參數(shù)

void Init( int i )

{

// 分別為:煙花中心到圖片邊緣的最遠(yuǎn)距離、煙花中心到圖片左上角的距離 (x、y) 兩個(gè)分量

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; // 煙花中心坐標(biāo)

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; // 綻放時(shí)間間隔

Fire[i].t1 = timeGetTime();

Fire[i].r = 0; // 從 0 開始綻放

/**** 初始化煙花彈 *****/

Jet[i].x = -240; // 煙花彈左上角坐標(biāo)

Jet[i].y = -240;

Jet[i].hx = -240; // 煙花彈發(fā)射最高點(diǎn)坐標(biāo)

Jet[i].hy = -240;

Jet[i].height = 0; // 發(fā)射高度

Jet[i].t1 = timeGetTime();

Jet[i].dt = rand() % 10; // 發(fā)射速度時(shí)間間隔

Jet[i].n = 0; // 煙花彈閃爍圖片下標(biāo)

Jet[i].shoot = false; // 是否發(fā)射

}

c語(yǔ)言煙花簡(jiǎn)單版的介紹就聊到這里吧,感謝你花時(shí)間閱讀本站內(nèi)容,更多關(guān)于c語(yǔ)言編程愛心代碼、c語(yǔ)言煙花簡(jiǎn)單版的信息別忘了在本站進(jìn)行查找喔。

掃描二維碼推送至手機(jī)訪問(wèn)。

版權(quán)聲明:本文由飛速云SEO網(wǎng)絡(luò)優(yōu)化推廣發(fā)布,如需轉(zhuǎn)載請(qǐng)注明出處。

本文鏈接:http://m.atlasseeker.com/post/9610.html

“c語(yǔ)言煙花簡(jiǎn)單版(c語(yǔ)言編程愛心代碼)” 的相關(guān)文章

中醫(yī)ppt模板免費(fèi)下載百度云(中醫(yī)ppt模板免費(fèi)下載 素材)

中醫(yī)ppt模板免費(fèi)下載百度云(中醫(yī)ppt模板免費(fèi)下載 素材)

今天給各位分享中醫(yī)ppt模板免費(fèi)下載百度云的知識(shí),其中也會(huì)對(duì)中醫(yī)ppt模板免費(fèi)下載 素材進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、免費(fèi)的ppt模板哪里有 2、PPT模版的下載資源有哪些? 3、哪里可以下載PPT模板? 4、請(qǐng)問(wèn)大佬有PPT模...

服裝設(shè)計(jì)PPT模板免費(fèi)下載(服裝設(shè)計(jì)ppt模板圖片)

服裝設(shè)計(jì)PPT模板免費(fèi)下載(服裝設(shè)計(jì)ppt模板圖片)

本篇文章給大家談?wù)劮b設(shè)計(jì)PPT模板免費(fèi)下載,以及服裝設(shè)計(jì)ppt模板圖片對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、網(wǎng)上服裝購(gòu)物系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn) 答辯ppt怎么寫 2、鞋子、服裝設(shè)計(jì)都需要什么軟件? 3、有沒(méi)有一個(gè)可以學(xué)習(xí)服裝設(shè)計(jì)APP軟件? 網(wǎng)上服裝購(gòu)物系...

二手木模板多少錢一張(木模板價(jià)格多少一張)

二手木模板多少錢一張(木模板價(jià)格多少一張)

本篇文章給大家談?wù)劧帜灸0宥嗌馘X一張,以及木模板價(jià)格多少一張對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、請(qǐng)問(wèn)現(xiàn)在做建筑模板多少錢一平方?謝謝 2、工地上的廢模板和廢方木賣給廢品站分別可以賣多少錢一噸? 3、合肥市二手木料,工地廢舊方木,模板的交易市場(chǎng)在哪里?...

免費(fèi)語(yǔ)音包軟件下載(語(yǔ)音包軟件下載安裝)

免費(fèi)語(yǔ)音包軟件下載(語(yǔ)音包軟件下載安裝)

本篇文章給大家談?wù)劽赓M(fèi)語(yǔ)音包軟件下載,以及語(yǔ)音包軟件下載安裝對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、和平精英搞笑語(yǔ)音包怎么下載 2、免費(fèi)變聲器軟件有哪些? 3、在哪里下載離線語(yǔ)音包 和平精英搞笑語(yǔ)音包怎么下載 想要下載語(yǔ)音包很簡(jiǎn)單,首先在游戲的主界面點(diǎn)擊...

淘寶主圖模板下載(淘寶主圖模板制作軟件)

淘寶主圖模板下載(淘寶主圖模板制作軟件)

本篇文章給大家談?wù)勌詫氈鲌D模板下載,以及淘寶主圖模板制作軟件對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、如何制作淘寶主圖視頻?求大師幫忙 2、怎樣做淘寶主圖 3、淘寶主圖下載軟件哪個(gè)好用? 如何制作淘寶主圖視頻?求大師幫忙 1、 暴風(fēng)影音:獲益最大的應(yīng)用,...

首涂模板(首涂模板影視大全)

首涂模板(首涂模板影視大全)

本篇文章給大家談?wù)勈淄磕0?,以及首涂模板影視大全?duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、我想做個(gè)影視網(wǎng)站用什么模板比較好? 我想做個(gè)影視網(wǎng)站用什么模板比較好? 模板 只是個(gè)皮囊而已。。?!W(wǎng)站 并不是說(shuō)一個(gè)程序安裝了能訪問(wèn)了...