Addition Problem Statement
Addition Problem Statement
Final Project
Aero 220-500
For this project, we have to be able to add two nxn matrices. The two matrices have to have the same number of rows and columns. Therefore, you have to add the same the components of the matrix with each other. The final result (the added matrix), will also be nxn.
Matrix 2= 4 5 1 7 4 8 9 6 3
Matrix 1 + Matrix 2= 5 9 8 9 9 16 12 12 12
Algorithm 1) void Matrixclass::addition(Matrixclass z,ofstream&outfile) //Refers the function to its class in the header file a. Matrixclass sum(height, width) i. for (int i=0; i<height; i++) ii. for (int j=0; j<width; j++) 1. sum.matrix[i][j]=z.matrix[i][j]+matrix[i][j] //The function to find the sum to two matrices b. sum.display(outfile); //Puts the addition of the two matrices into a text file