Question: Matrix operations, write a C++ program procedural code not object oriented!!, that reads two matrices and: 1) adds them (if compatible) andprints their sum, 2)
Matrix operations, write a C++ program procedural code not object oriented!!, that reads two matrices and: 1) adds them (if compatible) andprints 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 3matrix input file:2 31 -1 02 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 1A + B = 2 -3 1 2 2 1 1 -2 2A - B = 0 1 -1 2 0 1 -1 0 0A * B = 1 -3 1 3 -4 3 1 -2 1
Please add comments if you can even to functions and as stated in the main text needs to be C++, I will be using visual studio to use the code also no c language!!
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
