Question: **C++ Procedural Code** Write a program,assignment11.cpp, that reads two matrices and: 1) adds them (if compatible) and prints their sum, 2) subtracts them (if compatible)

**C++ Procedural Code** Write a program,assignment11.cpp, that reads two matrices and: 1) adds them (if compatible) and prints their sum, 2) subtracts them (if compatible) and prints their difference, and3) multiplies them (if compatible) and prints their product. Prompt the user for thenames of two matrix input files (see format below) and place the output in a file ofthe users choosing.The format of the input files should contain the number of rows, followed by thenumber of columns, followed by the matrix data; here is an example of a 2 by 3 matrix input file:

2 3

1 -1 0

2 0 1

Although the examples here use integers as elements of matrices, your codeshould allow matrices to contain doubles.

Here is an example of the output expected:

Matrix A = 1 -1 0 2 1 1 0 -1 1

Matrix B = 1 -2 1 0 1 0 1 -1 1

A + B = 2 -3 1 2 2 1 1 -2 2

A - B = 0 1 -1 2 0 1 -1 0 0

A * B = 1 -3 1 3 -4 3 1 -2 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!