From 501502f00b62ed2c3e7e409bbb525e0a7a408905 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Thu, 17 Nov 2022 22:11:15 -0500 Subject: [PATCH] check if command is dot or cross --- src/main.nim | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main.nim b/src/main.nim index 4610cdb..604df7c 100644 --- a/src/main.nim +++ b/src/main.nim @@ -1,6 +1,17 @@ -import strutils, sequtils, procedures #, strformat +import strutils, sequtils, os, procedures #, strformat + +var operation: string +case paramStr(0): + of "dot": + operation = "dot" + echo "Parameter is dot" + of "cross": + operation = "cross" + echo "Parameter is cross" + else: + # TODO: ask user to preform dot or cross product + echo "maultrix" -# TODO: check if command was either dot or cross product echo "Enter number of rows in the first matrix:" let r1: int = parseInt(readLine(stdin)) @@ -10,6 +21,8 @@ var m1 = newSeqWith(r1, newSeq[float](c1)) procedures.fillMatrix(m1, r1, c1) +echo "" + echo "Enter number of rows in the second matrix:" let r2: int = parseInt(readLine(stdin)) echo "Enter number of columns in the second matrix:" @@ -18,7 +31,14 @@ var m2 = newSeqWith(r2, newSeq[float](c2)) procedures.fillMatrix(m2, r2, c2) +# TODO: calculate dot product (in procedures) + +# TODO: calculate cross product (in procedures) + echo "\nFirst matrix is:" procedures.printMatrix(m1, r1) echo "\nSecond matrix is:" procedures.printMatrix(m2, r2) + +# TODO: print result to stdout +