0% found this document useful (0 votes)
9 views

Addition Problem Statement

This document describes adding two matrices of the same dimensions. It states that each element in the resulting matrix is the sum of the corresponding elements in the two original matrices. An example addition is shown with two 3x3 matrices being added to produce a 3x3 sum matrix. An algorithm is provided that uses nested for loops to iterate through each matrix element and add the corresponding elements to produce the sum matrix.

Uploaded by

Patrick LaGrone
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Addition Problem Statement

This document describes adding two matrices of the same dimensions. It states that each element in the resulting matrix is the sum of the corresponding elements in the two original matrices. An example addition is shown with two 3x3 matrices being added to produce a 3x3 sum matrix. An algorithm is provided that uses nested for loops to iterate through each matrix element and add the corresponding elements to produce the sum matrix.

Uploaded by

Patrick LaGrone
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Jonathan P.

LaGrone Problem Statement (Adding Matrices)

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.

Test Case Matrix 1= 1 4 7 2 5 8 3 6 9

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

You might also like