aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Proj3/Functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Proj3/Functions.cpp')
-rw-r--r--CST116F2021-Proj3/Functions.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/CST116F2021-Proj3/Functions.cpp b/CST116F2021-Proj3/Functions.cpp
new file mode 100644
index 0000000..4a04137
--- /dev/null
+++ b/CST116F2021-Proj3/Functions.cpp
@@ -0,0 +1,49 @@
+#include "Header.h"
+
+//function definitions
+void getNewMatrices(float Matrix1[3][3], float Matrix2[3][3])
+{
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ cout << "Value " << (i*3) + (j+1) << " of Matrix 1: ";
+ cin >> Matrix1[i][j];
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ cout << "Value " << (i * 3) + (j + 1) << " of Matrix 2: ";
+ cin >> Matrix2[i][j];
+ }
+ }
+}
+
+void addMatrices(float Matrix1[3][3], float Matrix2[3][3])
+{
+ float displayMatrix[3][3];
+ char upperCornerL = 218, upperCornerR = 191, lowerCornerL = 192, lowerCornerR = 217;
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ displayMatrix[i][j] = Matrix1[i][j] + Matrix2[i][j];
+ }
+ }
+
+ cout << upperCornerL << setw(21) << upperCornerR
+ << endl;
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ cout << setw(6) << displayMatrix[i][j];
+ }
+ cout << endl;
+ }
+ cout << lowerCornerL << setw(21) << lowerCornerR;
+} \ No newline at end of file