// this program prints a two dimensional array on screen // to simulate the game of life settings. #include #include #include void main(void) { int i, j; int n; srand(unsigned(time((time_t *)NULL))); cout << " enter the size of the square : "; cout.flush(); cin >> n; for (i = 0; i < n; i ++) { for (j = 0; j < n; j ++) if (rand() % 2 == 0) // life cell cout << 1; else cout << 0; cout << endl; } // for }