summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBensProgramma <[email protected]>2021-11-27 12:05:17 -0800
committerGitHub <[email protected]>2021-11-27 12:05:17 -0800
commit8f61cf7d9848522aa6661272e3b8bc8cb7ce1b57 (patch)
treead53f6377a040813aa33239276f2e5e208b8e281
parentUpdate Project_3_Hernandez_Schroeder.cpp (diff)
downloadproject_3_hernandez_schroeder-8f61cf7d9848522aa6661272e3b8bc8cb7ce1b57.tar.xz
project_3_hernandez_schroeder-8f61cf7d9848522aa6661272e3b8bc8cb7ce1b57.zip
notes added ( BAS )
The addMatrices(), getMatrices() functions look good! I added a few notes to consider for additional features.
-rw-r--r--Project3_Hernandez_Schroeder/Project_3_Hernandez_Schroeder.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/Project3_Hernandez_Schroeder/Project_3_Hernandez_Schroeder.cpp b/Project3_Hernandez_Schroeder/Project_3_Hernandez_Schroeder.cpp
index 5c775e5..306f93a 100644
--- a/Project3_Hernandez_Schroeder/Project_3_Hernandez_Schroeder.cpp
+++ b/Project3_Hernandez_Schroeder/Project_3_Hernandez_Schroeder.cpp
@@ -167,10 +167,10 @@ void getMatrices()
cout << endl << "Enter Elements for the 1st Matrix: " << endl;
- for (i = 0; i < row; i++)
+ for (i = 0; i < row; i++) // These two commands 'row' and 'col' are not really necessary they could be replaced with a '3' for this specific program (BAS)
for (j = 0; j < col; j++)
{
- cout << "Enter Element A" << i + 1 << j + 1 << " : " << endl;
+ cout << "Row: " << i + 1 <<" Element "<< j + 1 << " : " << endl;
cin >> MatrixA[i][j];
}
@@ -178,9 +178,13 @@ void getMatrices()
for (i = 0; i < row; i++)
for (j = 0; j < col; j++)
{
- cout << "Enter Element B" << i + 1 << j + 1 << " : " << endl;
+ cout << "Row " << i + 1 << " Element "<< j + 1 << " : " << endl;
cin >> MatrixB[i][j];
}
+
+
+
+ // It may also be a good thing if we were to also display the two completed matrices that the user input here...(BAS)
}
@@ -197,15 +201,16 @@ void multiplyMatrices(float[3][3], float[3][3], float[3][3])
void addMatrices(float MatrixA[3][3], float MatrixB[3][3], float MatrixC[3][3])
{
- for (int i = 0; i < row; i++)
+ for (int i = 0; i < row; i++) // Again these commands 'row' and 'col' can be replaced with '3' for this specific program (BAS)
for (int j = 0; j < col;j++)
MatrixC[i][j] = MatrixA[i][j] + MatrixB[i][j];
-
- cout << "The Sum: " << endl;
+
+
+ cout << "The Sum: " << endl; //I was thinking is might be nice to also display the input matrices again before displaying the result (for clarity) (BAS)
for (i = 0; i < row; i++)
for (j = 0; j < col; j++)
{
- cout << MatrixC[i][j] << " ";
+ cout << MatrixC[i][j] << "\t";
if (j == col - 1)
cout << endl;
}