summaryrefslogtreecommitdiff
path: root/Q1.cpp
diff options
context:
space:
mode:
authorMichael Abed <michaelabed@gmail.com>2012-04-09 01:45:23 -0400
committerMichael Abed <michaelabed@gmail.com>2012-04-09 01:48:41 -0400
commit1ba0668dbcf5bc4c40d99ac963711e35797c8efa (patch)
treeb359b81f4e538e923366a7c718d9defd9b823bc4 /Q1.cpp
downloadec327-lab3-master.tar.gz
ec327-lab3-master.tar.bz2
ec327-lab3-master.zip
finished assignmentHEADmaster
Diffstat (limited to 'Q1.cpp')
-rw-r--r--Q1.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/Q1.cpp b/Q1.cpp
new file mode 100644
index 0000000..2a2b03a
--- /dev/null
+++ b/Q1.cpp
@@ -0,0 +1,46 @@
+
+#include <iostream>
+
+#include "MatrixMultiply.h"
+
+using namespace std;
+int main(int argc, const char *argv[])
+{
+ int i,j;
+ double **m1 = new double*[3];
+ double **m2 = new double*[3];
+ for (i = 0; i < 3; i++) {
+ m1[i] = new double[3];
+ m2[i] = new double[2];
+ }
+ double **res;
+
+ cout << "Enter m1 as a 3x3 matrix row by row:" << endl;
+ for (i = 0; i < 3; i++) {
+ cout << "row" << i+1 << ": ";
+ for (int j = 0; j < 3; j++)
+ cin >> m1[i][j];
+ }
+ cout << "Enter m2 as a 3x2 matrix row by row:" << endl;
+ for (i = 0; i < 3; i++) {
+ cout << "row" << i+1 << ": ";
+ for (int j = 0; j < 2; j++)
+ cin >> m2[i][j];
+ }
+
+ res = matrixmultiply(m1,m2);
+
+ cout << "Result or m1*m2:" << endl;
+
+ cout << "["<< endl;
+ for (i = 0; i < 3; i++) {
+ cout << " [";
+ for (j = 0; j < 2; j++) {
+ cout << " " << res[i][j] << " ";
+ }
+ cout << "]" << endl;
+ }
+ cout << "]" << endl;
+
+ return 0;
+}