From 747d1f59dea35324711c74b41ae6b54e1dae6a7c Mon Sep 17 00:00:00 2001 From: James Lawrance Date: Wed, 8 Dec 2021 14:43:41 -0800 Subject: Project 3 Final 12/8/2021 --- CST116F2021-Proj3/Functions.cpp | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 CST116F2021-Proj3/Functions.cpp (limited to 'CST116F2021-Proj3/Functions.cpp') 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 -- cgit v1.2.3