2024-09-11 17:56:12
管理员
操作:新建一个文本文档,输入以下代码,再将扩展名修改为Bat,运行即可。在每个人 的印象中,程序员正在键盘上敲击手指,然后电脑上出现一些五颜六色的代码。而实际上呢?至少作为初学者,用cmd模拟矩阵。
命令提示符代码:(0-1)
@echo off
title 黑客帝国
setlocal ENABLEDELAYEDEXPANSION
color 0a
for /l %%i in (1,1,80) do (
set Down%%i=0
)
:loop
for /l %%j in (1,1,80) do (
set /a Down%%j-=1
if !down%%j! LSS 0 (
set /a Arrow%%j=!random!%%4
set /a Down%%j=!random!%%15+10
)
if “!Arrow%%j!” == “1” (
set /a chr=!random!%%2
set /p=!chr!<nul
) else (
set /p= <nul
)
)
goto loop
goto :eof
命令提示符代码:(0-9)
@echo off
title 黑客帝国
color 0a
setlocal ENABLEDELAYEDEXPANSION
for /l %%i in (0) do (
set “line=”
for /l %%j in (1,1,80) do (
set /a Down%%j-=2
set “x=!Down%%j!”
if !x! LSS 0 (
set /a Arrow%%j=!random!%%3
set /a Down%%j=!random!%%15+10
)
set “x=!Arrow%%j!”
if “!x!” == “2” (
set "line=!line!!random:~-1! "
) else (set “line=!line! “)
)
set /p=!line!<nul
)
补充上C++代码:(0-9)
#include “stdafx.h”
#include “stdlib.h”
#include “windows.h”
int main(int argc, char* argv[])
{
system(“color 0a”);
while(1){
printf(”%c”,(rand()%10>5?‘0’+rand()%10:’ '));
if(rand()%100>80){
Sleep(static_cast<long>(rand()%10));
}
}
return 0; // via : Blast
}