cleaned up code
This commit is contained in:
parent
5549aa5e28
commit
198e16ad7f
|
@ -1,13 +1,13 @@
|
|||
import strutils, sequtils
|
||||
|
||||
proc getInt(): int =
|
||||
proc getInt: int =
|
||||
while(true):
|
||||
try:
|
||||
return parseInt(readline(stdin))
|
||||
except:
|
||||
echo "Please enter an integer, try again."
|
||||
|
||||
proc getFloat(): float =
|
||||
proc getFloat: float =
|
||||
while(true):
|
||||
try:
|
||||
return parseFloat(readline(stdin))
|
||||
|
@ -25,7 +25,6 @@ proc fillMatrix*(matrix: var seq[seq[float]], row, col: int) =
|
|||
for i in countup(1, row):
|
||||
for j in countup(1, col):
|
||||
echo "Enter item:"
|
||||
# var entry: float = getFloat() # TODO: while loop to check if input is valid
|
||||
matrix[i-1].add(getFloat())
|
||||
matrix[i-1].delete(0)
|
||||
echo matrix[i-1]
|
||||
|
@ -59,7 +58,7 @@ proc calcCross(vector1: array[3, float], vector2: array[3, float]): array[3, flo
|
|||
let k: float = vector1[0] * vector2[1] - vector1[1] * vector2[0]
|
||||
result = [i, j, k]
|
||||
|
||||
proc dot*() =
|
||||
proc dot* =
|
||||
echo "MATRIX DOT PRODUCT"
|
||||
|
||||
#? record first matrix
|
||||
|
@ -91,7 +90,7 @@ proc dot*() =
|
|||
echo "\nResult matrix is:"
|
||||
printMatrix(m)
|
||||
|
||||
proc cross*() =
|
||||
proc cross* =
|
||||
echo "VECTOR CROSS PRODUCT"
|
||||
|
||||
type
|
||||
|
|
Loading…
Reference in a new issue