check if command is dot or cross

This commit is contained in:
array-in-a-matrix 2022-11-17 22:11:15 -05:00
parent d42bcf9c42
commit 501502f00b

View file

@ -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