double matrix[3][3];
ifstream fin("input.txt");
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
fin >> matrix[i][j];
Now just refer to matrix[i][j] when looking at an element. If you want a matrix to have more than 2 dimensions, or if you want anything but a 3x3 matrix, check out dynamic memory allocation or STL containers.