Part of a project I am doing involves taking the information from one text file and putting it into two separate arrays. Whenever I build and run the program stops responding after I copy elements into the mpd array. It outputs the information correctly on the screen but then it stops running. Any help appreciated.
for (y = 0; y < 5; y++)
{
for (x = 1; x < 8; x++)
{
stringstream sso;
sso << input[y][x];
sso >> mpd[y][x];
cout << mpd[y][x] << " ";
}
cout << "\n";
}
x goes from 1 to 8, but for `mpd' the valid index goes from 0 to 7.
So you are accessing out of bounds and invoking undefined behaviour.
Change it to mpd[y][x-1]