知识点:循环、条件判断、函数、结构体
// 黑客帝国数字雨特效.cpp
#include "stdafx.h"
#include <stdio.h>
#include <graphics.h> //图形库头文件
#include <Windows.h>
#define WIDTH 960 //宏定义,定义宽和高
#define HEIGTH 640
#define STR_SIZE 20 //数字雨数组最大存储
#define STR_NUM 128 //1920/15=128 数字雨的串数
#define STR_WIDTH 15 //雨的距离15,字符宽度
struct Rain //雨的结构
{
int x;//数字雨横向位置
int y;//y坐标
int speed;//下降速度
char str[STR_SIZE];//数字雨数组
}rain[STR_NUM];//结构体数组
char CreateCh(){
//随机产生一个字符
char temp=0;
int flag=rand()%3; //rand随机产生0~3的数字:0、1、2,所以概率每个都是1/3。
switch (flag)
{
case 0:temp=rand()%26+'a'