黑客帝国 程序员,黑客帝国c语言

hacker2023-03-05黑客164

如何实现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")

几个基本的颜色;

黑客一般使用的是C语言还是C++呢?为什么?

黑客用的最多的是shell 尽量用C,麻烦的用C++ C程序体积小,运行快 我现在学的程序都不知道是C还是C++了,好像都混在一起,自己也分不清. 本人觉得黑客大多使用C的,C++一般用来做大的项目的. 同样的代码,C执行的效率是否比C++快呢?这个不知道.本人太菜了.呵呵......

用C语言编个像黑客帝国的那种的01数字瀑布

没时间做,但给你个思路:

主要的类:Class TextBar,应该包含字串变量保存要显示字符,还应包含一个贴图资源,作为字符绘制后的颜色mask,呈现出文字渐变效果;应该包含的基本方法:绘制(实现字符由上到下绘制以及贴图);衍生的其它子程序都是围绕这个功能的,例如计算字符位置,贴图位置,产生,消失等。

主类:与TextBar是聚合关系或组合关系。创建TextBar实例并给予其初始化值和位置。

评论列表

访客
访客
2023-03-06

*设置颜色*/void set_color(int color){   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);}main(){

访客
访客
2023-03-05

[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[

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。