如何编写代码雨(怎么编写代码)

http://www.itjxue.com  2023-03-03 22:37  来源:未知  点击次数: 

如何实现c语言程序各颜色数字雨代码

#includestdio.h

#includetime.h

#includewindows.h

typedef struct

{

int x,y;

char ch;

}STU;

STU st[100];

//出现位置?

void gotoxy(int x, int y)

{

? HANDLE hout;

? COORD pos;

? pos.X = x;

? pos.Y = y;

? hout = GetStdHandle(STD_OUTPUT_HANDLE);

? SetConsoleCursorPosition(hout, pos);

}

/*隐藏光标*/

void show_cursor(int hide)

{

? CONSOLE_CURSOR_INFO cciCursor;

? HANDLE hout;

? hout = GetStdHandle(STD_OUTPUT_HANDLE);

? if(GetConsoleCursorInfo(hout, cciCursor))

? {

? ? ? cciCursor.bVisible = hide;

? ? ? SetConsoleCursorInfo(hout, cciCursor);

? }

}

/*设置颜色*/

void set_color(int color)

{

? SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);

}

main()

{

int i,j;

show_cursor(0);

srand(time(NULL));

//初始化结构体

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

{

st[i].x = rand()%80;

st[i].y = rand()%20;

st[i].ch = rand()%(49-47)+48;

}

while (1)

{

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

{

gotoxy(st[i].x,st[i].y);

set_color(0x2);//最先出现的颜色;

putchar(st[i].ch);

gotoxy(st[i].x,st[i].y-5);

putchar(' ');

st[i].y++;

st[i].ch = rand()%(49-47)+48;

if (st[i].y-5=18)

{

gotoxy(st[i].x,st[i].y-1);

putchar(' ');

gotoxy(st[i].x,st[i].y-2);

putchar(' ');

gotoxy(st[i].x,st[i].y-3);

putchar(' ');

gotoxy(st[i].x,st[i].y-4);

putchar(' ');

gotoxy(st[i].x,st[i].y-4);

putchar(' ');

}

if (st[i].y 23)

{

st[i].x = rand()%80;

st[i].y = rand()%20;

}

gotoxy(st[i].x,st[i].y);

set_color(0xA);//由前一个颜色渐变成的颜色

putchar(st[i].ch);

}

Sleep(120);

}

}

????color(0);???printf("黑色\n");??????color(1);???printf("蓝色\n");??????color(2);???printf("绿色\n");???????color(3);???printf("湖蓝色\n");??????color(4);???printf("红色\n");??????color(5);???printf("紫色\n");??????color(6);???printf("黄色\n");???????color(7);???printf("白色\n");??????color(8);???printf("灰色\n");??????color(9);???printf("淡蓝色\n");??????color(10);??printf("淡绿色\n");??????color(11);??printf("淡浅绿色\n");???????color(12);??printf("淡红色\n");??????color(13);??printf("淡紫色\n");??????color(14);??printf("淡黄色\n");??????color(15);??printf("亮白色\n")

几个基本的颜色;

cmd命令数字雨教程

有很多朋友对于cmd命令数字雨很感兴趣,那么跟着我来一起看看cmd命令数字雨的教程吧。

01

首先,我们点击鼠标右键在桌面新建一个文本文档。

02

打开文本文档并输入如下代码:

@echo off

color 0a

:start

echo 6 1 7 1 7 f 1 f 1 3 3 0 0 6 0 0 1 r 3 4 1 2 3 1 1 2 1 g 1 2 1 1 1 1 1 1 1 1 1 1

ping localhost -n 1 null

echo 5 2 1 4 1 j 8 1 1 3 2 1 1 4 2 1 2 r 0 3 2 3 4 5 6 g 2 5 8 2 2 2 2 2 2 2 2 2 2 2

ping localhost -n 1 null

echo 2 0 1 7 2 0 1 8 2 0 1 8 2 0 1 8 e b 7 7 4 4 4 1 1 1 5 5 3 8 6 5 6 5 6 5 6 5 2 1

ping localhost -n 1 null

echo 2 0 1 7 2 0 1 8 2 0 1 8 2 0 1 8 e o 5 7 8 4 4 1 1 4 0 5 0 8 7 8 9 5 4 2 0 3 0 0

ping localhost -n 1 null

goto start

03

点击“文件”-“另存为”,把这串代码保存下来。

04

把文件名改为“数字雨.bat”,注意:后缀名一定要为“.bat”,点击保存。

05

然后退回桌面,我们就发现桌面多了一个“数字雨”的图标。

06

点击“数字雨”,进去以后代码雨就制作成功了。通过ESC或点击鼠标,可以退出。

手机代码雨的代码是什么

fghy。

雨字使用手机五笔与一般五笔输入法一样,代码是fghy。代码就是程序员用开发工具所支持的语言写出来的源文件,是一组由字符、符号或信号码元以离散形式表示信息的明确的规则体系。

如何用html或者js制作天降很多的滑稽还有代码雨的特效?

style

* {

margin:0;

padding:0;

}

body {

background:black;

overflow:hidden;

}

.container {

width:20px;

height:60px;

position:absolute;

}

.nav {

height:20px;

width:20px;

display:block;

margin-top:12px;

border-radius:10px;

background:#33ccff;

opacity:0.8;

background: url(1.jpg) no-repeat center;

background-size: auto 100%;

}

/style

script

$(function() {

var w = window.screen.width;

var h = window.screen.height;

var count = 0;

var drop = function() {

this.v = Math.random() * 1 + 0.5;

this.left = Math.random() * w;

}

drop.prototype = {

constructor: drop,

create: function() {

count++;

var $drop = $('div class="container"span class="nav"/span/div');

$drop.appendTo('body');

},

addCss: function() {

$('.container:last').css({

left: this.left + 'px'

})

},

dropEvent: function() {

var time = Math.floor(h / this.v);//下降速度

$('.container:last').animate({

top: h + 'px',

opacity: '1'

}, time)

}

}

function updata() {

if(count 200) {

for(var i = 0; i 100; i++) {

$('div:first').remove();

}

count = 0;

}

}

setInterval(function() {

var Drop = new drop();

Drop.create();

Drop.addCss();

Drop.dropEvent();

updata();

}, 50)

})

/script

(责任编辑:IT教学网)

更多

推荐CorelDraw教程文章