Question: IN C++ !!! Write a program that reads the entries of two matrices A, B from a file. The name of the file is matrixAB.txt.
IN C++ !!!
Write a program that reads the entries of two matrices A, B from a file. The name of the file is matrixAB.txt. Each line of the file represents one matrix record. The record consists of the matrix symbol (single character) and the four entries of a 2x2 matrix. The first two numbers represent first row entries of matrix (x11, x12) and the third and fourth entries represent second row entries (x21, x22).
You will produce a nicely formatted output file that displays the A, B, C, D, and P records, each on a separate line. The C matrix is A+B, The D matrix is B-A, and the P matrix is the product of A and B (Please investigate matrix multiplication because the P matrix is not the product of corresponding entries). Name the output file MatrixABCDP.txt
Hint: Create the MatrixAB.txt file using Windows Notepad or other text editor.
So, if you want to enter A=1365 and B =104-2-1 then
Your input file MatrixAB.txt should have the following format:
A 1 3 6 5
B 6 4 -2 -1
Your program should produce an output file MatrixABCDP.txt with five records on five lines as described above.
Run your program for different matrices A and B and each time take a screenshot of the output file and paste to your project word document.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
