Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The goal is to make a program that calls a function and asks for the input of th

ID: 3556204 • Letter: T

Question

The goal is to make a program that calls a function and asks for the input of the matrices number and size. The function was given so im just creating the main

#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

void matrixMult (int a[][N], int b[][N], int c[][N])
{
for (int i=0; i<N; ++i)
{
for (int i=0; i<N; ++j)
{
c[i][j] = 0;
for (int k=0; k<N; ++k)
{
c[i][j] += a[i][k]*b[k][j];
}
}
}
return;
}
int main()
{
int a, b, N, c, i, j, matrixMult, first[10][10], second[10][10], sum[10][10];

cout << "Enter the number of rows and columns of matrix ";
cin >> m >> n;
cout << "Enter the elements of first matrix ";

for ( i=0 ; i<N ; c++)
for ( j=0 ; j<N ; j++)
cin >> first[i][j];

cout << "Enter the elements of second matrix ";

for ( i=0 ; i<N ;i++)
for ( j=0 ; j<N ; j++)
cin >> second[i][j];

cout << i << "Answer:"<< j << matrixMult << endl;

return 0;

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int a[5][5],b[5][5],c[5][5],m,n,p,q,i,j,k;
cout<<"Enter rows and columns of first matrix:";
cin>>m>>n;
cout<<"Enter rows and columns of second matrix:";
cin>>p>>q;

if(n==p)
{
cout<<" Enter first matrix: ";
for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];

cout<<" Enter second matrix: ";
for(i=0;i<p;++i)
for(j=0;j<q;++j)
cin>>b[i][j];
cout<<" The new matrix is: ";

for(i=0;i<m;++i)
{
for(j=0;j<q;++j)
{
c[i][j]=0;
for(k=0;k<n;++k)
c[i][j]=c[i][j]+(a[i][k]*b[k][j])...
cout<<c[i][j]<<" ";
}
cout<<" ";
}
}
else
cout<<" Sorry!!!! Matrix multiplication can't be done";
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote