Typing效果
在黑客帝国的电影中,有这样一段情节,尼奥在电脑面前休息,电脑突然跳出一个DOS窗口展现了打字的效果,今天闲来无事就模仿了一下。
代码只有几行,非常的简单:
#include<stdio.h>
#include <Windows.h>
#define MAX 100
#define MIN 0
int main(void) {
char ch[] = "---Trinity:They are watching you, Neo.
I know you were sitting at the computer night after night.
You are looking for him......
Same to you, when I found him, he told me that I was not really looking for him.
I was looking for an answer.
It is the question that drive us.
It is the question that brough you here.
The answer is out there.
It is also looking for you. ";
for (size_t i = 0; i < sizeof(ch); i++) {
int num = rand() % (MAX - MIN + 1) + MIN;
printf(" 33[32m%c 33[0m", ch[i]);
Sleep(num);
}
getchar();
return 0;
}