(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, k;
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];
for (i=0; i<N; i++) // Multiply
for (j=0; j<N; j++)
for (k=0; k<N; k++)
C[i][j] = A[i][k] * B[k][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;
}