From 0c39f5f945969e60e47de7224102087debcfd281 Mon Sep 17 00:00:00 2001 From: JordanHT-OIT Date: Wed, 8 Dec 2021 17:08:42 -0800 Subject: Transferred Project GitHub to Class GitHub Work was done within a different GitHub repo --- mainCode.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 mainCode.cpp (limited to 'mainCode.cpp') diff --git a/mainCode.cpp b/mainCode.cpp new file mode 100644 index 0000000..e2046b8 --- /dev/null +++ b/mainCode.cpp @@ -0,0 +1,62 @@ +//Code by Jordan Harris-Toovy (jordan.harristoovy@oit.edu) and Rayyan Ansari (rayyan.ansari@oit.edu) for OIT's CST116-01P project 3, December 2021 + +#include "mainHeader.h" + +int main() +{ + float arr1[3][3]{ 0.0F }, arr2[3][3]{ 0.0F }, arr3[3][3]{ 0.0F }; + int menuVal = 0, displayNumberLength = 5; + bool validChoice = false; + + cout << "Plase enter the first matrix:" << endl; //Get both arrays from the user + + arrayInput(arr1); + + cout << "Plase enter the second matrix:" << endl; + + arrayInput(arr2); + + cout << "Enter desired operation: \n1) Add the first matrix to the second\n2) Multiply the second matrix by the first" + << "\n3) Multiply the first matrix by the second" << endl; + + while (!validChoice) //Get user menu choice and validate it + { + validChoice = getInt(menuVal); + + if ((menuVal > 3) || (menuVal < 1) || !validChoice) + { + cout << "Invalid entry, enter again:"; + + validChoice = false; + } + } + + switch (menuVal) + { + case (1): //Addition of arr1 and arr2 into arr3 + + addArrays(arr1, arr2, arr3); + + displayTriArray(arr1, arr2, arr3, '+'); + + break; + + case (2): //Multiplication of arr2 by arr1 into arr3 + + multiplyArrays(arr1, arr2, arr3); + + displayTriArray(arr1, arr2, arr3, 'X'); + + break; + + case (3): //Multiplication of arr1 by arr2 into arr3 + + multiplyArrays(arr2, arr1, arr3); + + displayTriArray(arr2, arr1, arr3, 'X'); + + break; + } + + return (0); +} \ No newline at end of file -- cgit v1.2.3