admin 管理员组

文章数量: 1184232


2024年5月6日发(作者:linux系统安装nvidia)

// game of

//function head

#include (standard input &output输入输出)

#include (定义杂项函数及内存分配函数)

#include (对话框程序或者窗口程序)

#include (从系统时钟获取时间方式)

#include (字符函数)

//define the size of the two-dimensional array(定义大小的二维数组)

#define SIZE 40

void rule(int array[SIZE][SIZE]);//function prototype(函数原型)

void SetColor(unsigned short ForeColor=5,unsigned short

BackGroundColor=2) //change color(改变颜色)

{

HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleTextAttribute(hCon,ForeColor|BackGroundColor);

}

int main()

{

int data[SIZE][SIZE]={0};//0->virus(病毒) 1->cell(细胞) 2->boundary

(边界)

int i,j,instruct;

srand(time(NULL));//use the current time to seed the random number

generator(使用当前时间种子的随机数发生器)

for(i=0;i<=SIZE-1;i++){

for(j=0;j<=SIZE-1;j++){

if(i*j==0||i==SIZE-1||j==SIZE-1){

data[i][j]=22;

}//end if(如果结束)


本文标签: 函数 系统 时间 程序 内存