check if command is dot or cross
This commit is contained in:
parent
d42bcf9c42
commit
501502f00b
1 changed files with 22 additions and 2 deletions
24
src/main.nim
24
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:"
|
echo "Enter number of rows in the first matrix:"
|
||||||
let r1: int = parseInt(readLine(stdin))
|
let r1: int = parseInt(readLine(stdin))
|
||||||
|
@ -10,6 +21,8 @@ var m1 = newSeqWith(r1, newSeq[float](c1))
|
||||||
|
|
||||||
procedures.fillMatrix(m1, r1, c1)
|
procedures.fillMatrix(m1, r1, c1)
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
echo "Enter number of rows in the second matrix:"
|
echo "Enter number of rows in the second matrix:"
|
||||||
let r2: int = parseInt(readLine(stdin))
|
let r2: int = parseInt(readLine(stdin))
|
||||||
echo "Enter number of columns in the second matrix:"
|
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)
|
procedures.fillMatrix(m2, r2, c2)
|
||||||
|
|
||||||
|
# TODO: calculate dot product (in procedures)
|
||||||
|
|
||||||
|
# TODO: calculate cross product (in procedures)
|
||||||
|
|
||||||
echo "\nFirst matrix is:"
|
echo "\nFirst matrix is:"
|
||||||
procedures.printMatrix(m1, r1)
|
procedures.printMatrix(m1, r1)
|
||||||
echo "\nSecond matrix is:"
|
echo "\nSecond matrix is:"
|
||||||
procedures.printMatrix(m2, r2)
|
procedures.printMatrix(m2, r2)
|
||||||
|
|
||||||
|
# TODO: print result to stdout
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue