Question: Write a program that reads in two matrix files as command line arguments, adds them together, and prints the result to the screen. You are
You are to write a short program that reads in two files (given as command line arguments) containing matrix values, store each of those files in a 2d array, and add the two matrices together and print the result. The input matrix files look like this: $ more A.mat 10 20 30 40 50 60 $ more B.mat 1 2 3 4 5 6 The first line in the matrix file is the number of rows; the second line is the number of columns; the following lines contain the actual values for the matrix. To add two matrices together, they must be of the same dimension and then you simply add corresponding values together. For example, using the files above, matrix A + matrix B would give a resulting matrix that looked like this: 11 22 33 44 55 66
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
