It's usually a good idea to separate conceptually different things. This usually goes a long way to improve code clarity, maintainability, and flexibility.
There are at least two different things here:
You loop through arrays of data.
You compute something.
The best thing you could do is to separate these things into different functions, or better yet, classes. Something like this would do:
class MyFavoriteMatrix
{
private:
double m_P[2][2];
public:
MyFavoriteMatrix( double b, double r, double n ) {
m_P[0][0] = b*r+n;
m_P[0][1] = b*2.0*r+(1.0-n);
m_P[1][0] = b*b+r*n;
m_P[1][1] = r+n;
}
double Get( int i, int j ) {
return m_P[i][j];
}
}
Then your loop would look like this:
for(int t = 0; t < 10; ++t)
{
// Computation is performed in the constructor
MyFavoriteMatrix mfm( b[t], r[t], n[t] );
// Now put the result where it belongs
P[0][0][t] = mfm.Get( 0, 0 );
P[0][1][t] = mfm.Get( 0, 1 );
P[1][0][t] = mfm.Get( 1, 0 );
P[1][1][t] = mfm.Get( 1, 1 );
}
Notice these things about such solution:
If you change your mind about the storage containers (for example, as Mark B suggested, change P[2][2][10] to P[10][2][2] for performance reasons), you computational code won't be affected at all, only the relatively simple loop will change a bit.
If you need to perform the same computation in 10 different places you won't have to copy the computational code: you'll just call MyFavoriteMatrix there.
You you find out that the computational code needs to change you only need to modify it in one place: in MyFavoriteMatrix constructor.
Each piece of code looks neat, thus less chances for a typo.
And all that you get by separating conceptually different thing - computation and iteration.