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

2023-03-12 17:43:38 密码用途 思思

#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")

几个基本的颜色;

手机版钉钉如何搞出代码雨

1、首先下载钉钉,打开钉钉

2、然后输入账号密码点击回车键

3、点击任何一个好友

4、再点击屏幕下方的任何一个点

5、点击发送代码片段

6、然后编辑自己想要的代码

7、最后点击发送

手机代码雨的代码是什么

fghy。

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

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或点击鼠标,可以退出。