Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The highlighted this code is: void printItANS(long M [MAX][MAX]){ int i, j; cout This is the code I have. Please just fix my code and

image text in transcribed

The highlighted "this code" is:

void printItANS(long M [MAX][MAX]){ int i, j; cout  

This is the code I have. Please just fix my code and don't rewrite your own code. That is not what I'm asking for.

#include

#include

using namespace std;

const int MAXROW=100;

const int MAXCOL=100;

void matMul (const int A[][MAXCOL], const int B[][MAXCOL], int Ans[MAXROW][MAXCOL]);

void print(vector myVector);

int main ()

{

int matrix A[MAXROW][MAXCOL], B[MAXROW][MAXCOL], Ans[MAXROW][MAXCOL]=[0];

int row, col;

for(i=0; i

val = i+5

for (j=0; j

{m2[i][j]=val

val +=4;

}

{

int B

for(i=0; i

val = i

for (j=0; j

{m2[i][j]=val

val = i*i;

}

Initialize(A);

Initialize(B);

matMul (A, B, Ans);

for (row=0; row

{

for (col=0; col

cout

cout

}

return 0;

}

void matMul (const int A[][MAXCOL], const int B[][MAXCOL], int Ans[MAXROW][MAXCOL])

{

for (int i = 0; i

{

for (int j = 0; j

{

int sum = 0;

for (int k = 0; k

{

sum += (A[i][k] * B[k][j]);

}

Ans[i][j] = sum;

}

}

}

void print(vector myVector)

{

for (int i = 0; i

{

cout

}

cout

}

void printItANS(long long M [MAX][MAX]){

int i, j;

cout

for(i=0;i

for(j=0;j

cout

cout

}

cout

cout

for(i=90;i

for(j=90;j

cout

cout

}

cout

return;

}

This is the output we are trying to get

image text in transcribed

1. declare 2 matrices of size 100 in the main and initilize them (see below) 2. pass both matrices by VALUE to a function to multiply them 3. the main is to print the result of the multiplied matrices. 104108112116120124128132136140 10040090016002500360049006400810010000 SUBMISSION: 1. Submit your code with the constant reset to 10 (not 100) 2. Please use this code that prints the a part of the complete answer for the 100100. This code prints the upper left 1010 and the lower right 1010 of the answer matrix. Matrix567123626874multiply910114812248272296with3by31314151827558612666

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions