Game of Life C++
<p>Hi I'm currently making a program that find the number of the 'live' cells after the certain generations have been passed. Inputs are:</p>

<p>•first line, the rules of the game as specified above. i.e.: B3/S23 = A cell is "Born" if it has exactly 3 neighbours, "Survives" if it has 2 or 3 living neighbours; it dies otherwise.</p>

<p>•second line, a number i that is the number of iterations the game should progress.</p>

<p>•third line, 2 numbers that are the number of rows(n) and columns(m) in the board.</p>

<p>•n lines (the rows) with m (the colums) characters each. All characters are '#' or '.'</p>

<p>Finally the the board is toroidal. i.e. the left and right sides wrap around and the bottom and top sides wrap around.
And with my codes I am getting bunch of errors that I don't even know about... Plus I don't even know if I am doing it right... Can you guys please help me.</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;string&gt;
#include &lt;vector&gt;
using namespace std;
// other includes? Probably yes.
void copy(int m, int n, int array1[m][n], int array2[m][n]){
    for(int j = 0; j &lt; m; j++;){
        for(int i = 0; i &lt; n; i++)
            array2[j][i] = array1[j][i]; 
    }
}
void life(int array[m][n], m, n, string born, survive){
    //Copies the main array to a temp array so changes can be entered into a grid
    //without effecting the other cells and the calculations being performed on them.
    int temp[m][n];
    copy(array, temp);
    for(int j = 1; j &lt;= m; j++){
        for(int i = 1; i &lt;= n; i++) {
            //The Moore neighborhood checks all 8 cells surrounding the current cell in the array.
            int count = 0;
            count = array[j-1][i] + 
                array[j-1][i-1] +
                array[j][i-1] +
                array[j+1][i-1] +
                array[j+1][i] +
                array[j+1][i+1] +
                array[j][i+1] +
                array[j-1][i+1];

            //The cell dies.
            for(int k = 0; k &lt; born.length(); k++;){
                if(count == born[k])
                    temp[j][i] = 1;
            }
            for(int x = 0; x &lt; survive.length(); x++;){
                if(count != survive[k])
                    temp[j][i] = 0;
                if(count == x)
                    temp[j][i] = array[j][i];
            }
        }
    }
    copy(temp, array);
}
bool compare(int array1[m][n], int array2[m][n])
{
    int count = 0;
    for(int j = 0; j &lt; m; j++)
    {
        for(int i = 0; i &lt; n; i++)
        {
            if(array1[j][i]==array2[j][i])
                count++;    
        }
    }
    //Since the count gets incremented every time the cells are exactly the same,
    //an easy way to check if the two arrays are equal is to compare the count to 
    //the dimensions of the array multiplied together.
    if(count == m*n)
        return true;
    else
        return false;
}
// functions? Yep, there should be some.

int main(){
    string variable;
    string i;
    string grid;
    string board;
    getline(cin,variable);
    getline(cin,i);
    getline(cin,grid);
    getline(cin,board);
    auto pos_b= variable.find_first_of("B");
    auto pos_s= variable.find_first_of("S");
    pos_s -= pos_b;//now it's the length of size
    auto b = variable.substr(pos_b+1,pos_s-2);
    auto s = variable.substr(pos_s+1);
    int int_b = stoi(b);
    int int_s = stoi(s);

    cout &lt;&lt; int_b &lt;&lt; ' ' &lt;&lt; int_s &lt;&lt; endl;
    auto pos_spc= grid.find_first_of(' ');
    int row = stoi(grid.substr(0,pos_spc));
    int column = stoi(grid.substr(pos_spc+1));
    cout &lt;&lt; row &lt;&lt; ' ' &lt;&lt; column &lt;&lt; endl;

    int cnt = 0;
    int gen0[column][row];
    int todo[column][row];
    int backup[column][row];
    for(int j = 1; j &lt; m; j++){
        for (int i = 1; i &lt; n; i++){
            if(board[j][i] == '.')
                board[j][i] = 0;
            if(board[j][i] == '#')
                board[j][i] = 1;
        }
        for(int k = 0; k &lt; i; i++){
            if(i == 0)
                copy(gen0, todo, column,row);  
            copy(todo, backup,column,row);          
            print(todo);        
            life(int todo[column][row], column, row, string int_b, int_s);
            cnt++;
        }
    }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/Myazt.png" rel="nofollow">Test Cases</a>[test cases][2]<a href="https://i.stack.imgur.com/f9f90.png" rel="nofollow">test cases</a></p>