Question: Language is C++ My program accepts input from the user to read two files of matrices and add them together, I am trying to modify

Language is C++

My program accepts input from the user to read two files of matrices and add them together, I am trying to modify my code to create a program that multiplies the matrices instead. I'm also trying to change my code so that the program can read doubles instead of ints.

I have left added the assignment and txt files the program is trying to read at the bottom. Please provide a picture of the output.

MY CODE:

#include #include #include #include using namespace std;

int** theTable1; int** theTable2; int** theSum;

int main() {

int numRows, numCols;

string fileName1, fileName2; cout

ifstream fin1, fin2; fin1.open(fileName1); fin2.open(fileName2);

if (!fin1 || !fin2) { cout

fin1 >> numRows >> numCols; theTable1 = new int* [numRows];

for (int i = 0; i > theTable1[r][c]; } }

fin2 >> numRows >> numCols; theTable2 = new int* [numRows];

for (int i = 0; i > theTable2[r][c]; } }

theSum = new int* [numRows]; for (int i = 0; i

cout

cout

Assignment and Text Files:

Language is C++ My program accepts input from the user to read

MATRIX MULTIPLICATION Matrix multiplication is possible if the number of columns of the left-hand matrix is equal to the number of rows of the right-hand matrix. For example, if you wanted to multiply the 43 matrix above by a second matrix, that second matrix must have three rows. The resulting matrix has the row count of the first matrix, and the column count of the second matrix. For example, multiplying a 43 matrix by a 38 matrix produces a 48 result. The algorithm for matrix multiplication is readily available online. Write a program that prompts the user for the two files that contain the matrices, displays the two matrices, and then (if possible) multiplies them and displays the result. If multiplication is not possible, display an error message and exit. Note that matrix multiplication (unlike numeric multiplication) is not commutative, so make sure you provide the file names in the correct order. Matrix Multiplication File 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!