You are subscripting a three-dimensional array myArray[10][10][10]
four times myArray[i][t][x][y]
. You will probably need to add another dimension to your array. Also consider a container like Boost.MultiArray, though that's probably over your head at this point.