public void TestAddMarix() {
int[,] MatrixA ={ { 1, 2 }, { 2, 3 } };
int[,] MatrixB ={ { 3, 4 }, { 4, 5 } };
AddMatrix(MatrixA, MatrixB);
}
public int[,] AddMatrix(int[,] MatrixA, int[,] MatrixB)
{
int numberOfRows = MatrixA.Length / 2;
int numberOfCols = numberOfRows;
int[,] MatrixC = new int[numberOfRows, numberOfCols];
for (int i = 0; i <=numberOfRows; i++)
{
for (int j = 0; j <=numberOfCols; j++)
{
MatrixC[i, j] = MatrixA[i, j] + MatrixB[i, j];
}
}
return MatrixC;
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de