summaryrefslogtreecommitdiff
path: root/functionsAnsari.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'functionsAnsari.cpp')
-rw-r--r--functionsAnsari.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/functionsAnsari.cpp b/functionsAnsari.cpp
new file mode 100644
index 0000000..dc3b8e8
--- /dev/null
+++ b/functionsAnsari.cpp
@@ -0,0 +1,62 @@
+//Code by Rayyan Ansari for OIT's CST116-01P project 3, December 2021
+#include "mainHeader.h"
+
+
+void arrayInput(float array1[num][num]) {
+
+
+ for (int i = 0; i < num; i++) {
+
+ for (int x = 0; x < num; x++) {
+
+ float temp;
+
+ cout << "Input value for ROW " << i + 1 << " and COLOUMN " << x + 1 << ": ";
+ cin >> temp;
+ cout << endl;
+ array1[i][x] = temp;
+
+ }
+
+ }
+
+}
+
+void addArrays(float array1[num][num], float array2[num][num], float addedArray[num][num]) {
+
+ for (int i = 0; i < num; i++) {
+
+ for (int x = 0; x < num; x++) {
+
+ addedArray[i][x] = array1[i][x] + array2[i][x];
+
+
+ }
+
+ }
+
+
+
+}
+
+void multiplyArrays(float array1[num][num], float array2[num][num], float addedArray[num][num]) {
+
+
+ for (int i = 0; i < num; i++) {
+
+ for (int z = 0; z < num; z++) {
+
+ for (int x = 0; x < num; x++) {
+
+ addedArray[i][z] += (array1[i][x] * array2[x][z]);
+
+
+ }
+ }
+
+
+ }
+
+
+
+} \ No newline at end of file