multrix/src/main.nim

25 lines
751 B
Nim
Raw Normal View History

2022-11-17 21:35:45 -05:00
import strutils, sequtils, procedures #, strformat
2022-11-15 11:45:52 -05:00
2022-11-17 21:35:45 -05:00
# TODO: check if command was either dot or cross product
2022-11-15 11:45:52 -05:00
2022-11-17 21:35:45 -05:00
echo "Enter number of rows in the first matrix:"
let r1: int = parseInt(readLine(stdin))
echo "Enter number of columns in the first matrix:"
let c1: int = parseInt(readLine(stdin))
var m1 = newSeqWith(r1, newSeq[float](c1))
2022-11-15 11:45:52 -05:00
2022-11-17 21:35:45 -05:00
procedures.fillMatrix(m1, r1, c1)
2022-11-15 11:45:52 -05:00
2022-11-17 21:35:45 -05:00
echo "Enter number of rows in the second matrix:"
let r2: int = parseInt(readLine(stdin))
echo "Enter number of columns in the second matrix:"
let c2: int = parseInt(readLine(stdin))
var m2 = newSeqWith(r2, newSeq[float](c2))
2022-11-17 20:44:33 -05:00
2022-11-17 21:35:45 -05:00
procedures.fillMatrix(m2, r2, c2)
2022-11-17 20:44:33 -05:00
2022-11-17 21:35:45 -05:00
echo "\nFirst matrix is:"
procedures.printMatrix(m1, r1)
echo "\nSecond matrix is:"
procedures.printMatrix(m2, r2)