Why is my programming crashing
<p>For some reason my program is crashing in the loop, and im unsure what is causing the problem</p>

<p>Here is my code.</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;fstream&gt;
using namespace std;



int main()
{
    ifstream fin;
    ofstream fout;

    fin.open("dice.in");
    fout.open("dice.out");

    string line;
    int boardsize;
    int top;
    int side;

    fin &gt;&gt; boardsize &gt;&gt; top &gt;&gt; side;
    while(boardsize != 0)
    {
        int ** board;
        board = new int*[boardsize];

        //creates  a multi dimensional dynamic array
        for(int i = 0; i &lt; boardsize; i++)
        {
            board[i] = new int[boardsize];
        }

        //loop through the 2d array
        for(int i = 0; i &lt;= boardsize; i++)
        {
            getline(fin, line);
            for(int j = 0; j &lt; boardsize; j++)
            {
                if(i != 0)
                board[i][j] = (int)line[j];
            }
            line.clear();
        }


        fin &gt;&gt; boardsize &gt;&gt; top &gt;&gt; side;
    }

    fin.close();
    fout.close();
}
</code></pre>

<p>Here is the input file i am using</p>

<pre><code>3 6 4
632
562
463
3 6 4
632
556
423
7 6 4
4156*64
624*112
23632**
4555621
6*42313
4231*4*
6154562
0 0 0
</code></pre>
