(10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
// Matrix Multiplication
#include <iostream>
int main()
{
const unsigned short N = 3;
unsigned short i, j;
unsigned short A[N][N] = { { 1, 0, 1 },
{ 1, 1, 0 },
{ 0, 1, 1}
};
unsigned short B[N][N] = { { 1, 1, 0 },
{ 0, 1, 1 },
{ 1, 0, 1 }
};
unsigned short C[N][N] = { 0 };
for (i=0; i<N; i++) // Multiply
for (j=0; j<N; j++)
C[i][j] += A[i][j] * B[i][j];
for (i=0; i<N; i++) // Print out
{
for (j=0; j<N; j++)
std::cout << C[i][j] << ' ';
std::cout << std::endl;
}
return 0;
}