0

```
#include <iostream>
#include <fstream>
using namespace std;
int underPopulation; // Any cell with less than <underPopulation> liviving neighbors dies.
int overCrowding; // Any cell with more than <overCrowding> living neighbors dies.
int minNeighborsToLive; // Any cell with <minNeighborsToLive> living neighbors lives.
int reproduction; // Any dead cell with <reproduction> living neighbors becomes a live cell.
const int numRows = 22; // Number of rows in the board
const int numColumns = 80; // Number of columns in the board
char Community[numRows][numColumns]; // environment representing all the cells and their state.
//Function declarations
void initData();
void toggleState(int nRow, int nCol) ;
bool getCurrentCellState(int nRow, int nCol) ;
int getNumberAliveNeighbors(char myArray[][numRows][numColumns]);
int getNumberAliveNeighborsInRow(char myArray[numRows][numColumns]);
void generateNextCycleState(char Community[numRows][numColumns]);
void printArrayState();
int main()
{
char s, str[256];
ifstream input;
cout << "Enter the name of a text file containing an initial colony configuration" << endl;
cin >> str;
input.open(str);
if(input.fail())
{
cout << "Input file not found" << endl;
exit(1);
}
while(input.good())
{
if (input.good())
for(int x=0; x < numRows; x++)
{
for (int y=0; y < numColumns; y++)
{
s = input.get();
Community[x][y] = s;
}
}
}
input.close();
system("cls");
for(int x=0; x < 22; x++)
{
for (int y=0; y < 80; y++)
{
cout << Community[x][y];
}
}
cout << "Generation 1" << endl;
system("pause");
while (true)
{
printArrayState();
generateNextCycleState(Community[22][80]); // FIRST ERROR: LINE 70
system("pause");
system("CLS");
}
printArrayState();
return 0;
}
// Get the number of neighbors who are alive
int getNumberAliveNeighbors(char myArray[][numRows][numColumns]) {
int numAliveNeighbors = 0;
int col, row;
if (numRows > 0) // Check for top neighbors
{
row = numRows - 1;
numAliveNeighbors += getNumberAliveNeighborsInRow(myArray[row][numColumns]); // SECOND ERROR: LINE 87
}
if (numRows < (numRows - 1)) // Check for bottom neighbors
{
row = numRows + 1;
numAliveNeighbors += getNumberAliveNeighborsInRow(myArray[row][numColumns]); // THIRD ERROR: LINE 92
}
// Check for side neighbors
col = numColumns - 1;
if (col >= 0) {
if (getCurrentCellState(numRows, col)) {
numAliveNeighbors += 1;
}
}
col = numColumns + 1;
if (col < numColumns) {
if (getCurrentCellState(numRows, col)) {
numAliveNeighbors += 1;
}
}
return numAliveNeighbors;
}
// Get number of alive neighbors in a row
int getNumberAliveNeighborsInRow(char myArray[][numRows][numColumns]) {
int numAliveNeighbors = 0;
int col = numColumns - 1;
if (col >= 0) { // Check for left edge.
if (getCurrentCellState(numRows, col)) {
numAliveNeighbors += 1;
}
}
if (getCurrentCellState(numRows, numColumns)) { // Current position.
numAliveNeighbors += 1;
}
col = numColumns + 1;
if (col < numColumns) { // Check for right edge.
if (getCurrentCellState(numRows, col)) {
numAliveNeighbors += 1;
}
}
return numAliveNeighbors;
}
void generateNextCycleState(char Community[numRows][numColumns])
{
char nextGen[numRows][numColumns]; // Create a model for next generation
int nRow = 0;
// Copy data to next generation model.
for (nRow = 0; nRow < numRows; nRow++) {
for (int nCol = 0; nCol < numColumns; nCol++) {
nextGen[nRow][nCol] = Community[nRow][nCol];
}
}
// Check neighbors.
int numAliveNeighbors = 0;
for (nRow = 0; nRow < numRows; nRow++) {
for (int nCol = 0; nCol < numColumns; nCol++) {
numAliveNeighbors = getNumberAliveNeighbors(nextGen[nRow][nCol]); // FOURTH ERROR: LINE 163
if (getCurrentCellState(nRow, nCol)) { // Current cell is alive.
if (numAliveNeighbors < underPopulation) { // Current cell dead due to lonliness.
nextGen[nRow][nCol] = false;
}
if (numAliveNeighbors > overCrowding) { // Current cell dead due to over crowding.
nextGen[nRow][nCol] = false;
}
} else { // Current cell is dead.
if (numAliveNeighbors == reproduction) { // dead cell comes to life.
nextGen[nRow][nCol] = true;
}
}
}
}
// Copy the next gen data to original model.
for (nRow = 0; nRow < numRows; nRow++) {
for (int nCol = 0; nCol < numColumns; nCol++) {
Community[nRow][nCol] = nextGen[nRow][nCol];
}
}
}
void printArrayState(char myArray[][numRows][numColumns])
{
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j < numColumns; j++)
{
cout << myArray[i][j];
}
cout << endl;
}
}
```

the errors are:

line 70 - cannot convert parameter 1 from 'char' to 'char[][80]'

line 87 and 92 - cannot convert parameter 1 from 'char[80]' to 'char[][80]'

line 163- cannot convert parameter 1 from 'char' to 'char[][22][80]'

i tried searching google and these threads but i didn't find anything. if you guys find a link or something explaining how to fix the errors that would be great too. thanks!