kid named finger
This commit is contained in:
parent
5bc5e85110
commit
eae5c23730
12
Makefile
12
Makefile
|
@ -4,16 +4,20 @@ DOC_DIR := doc/
|
||||||
DOC_TYPE ?= doc
|
DOC_TYPE ?= doc
|
||||||
|
|
||||||
all:
|
all:
|
||||||
nim compile --out:$(BUILD_DIR) $(SRC_DIR)*.nim
|
nim compile --out:$(BUILD_DIR) $(SRC_DIR)*.nim
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
nim $(DOC_TYPE) --outdir:$(DOC_DIR) $(SRC_DIR)*.nim
|
nim $(DOC_TYPE) --outdir:$(DOC_DIR) $(SRC_DIR)*.nim
|
||||||
|
|
||||||
release:
|
release: clean
|
||||||
nim compile --define:release --out:$(BUILD_DIR) $(SRC_DIR)*.nim
|
nim compile --define:release --out:$(BUILD_DIR) $(SRC_DIR)*.nim
|
||||||
|
|
||||||
run:
|
run: all
|
||||||
@$(BUILD_DIR)main
|
@echo "===================================================="
|
||||||
|
@echo ""
|
||||||
|
@$(BUILD_DIR)main
|
||||||
|
|
||||||
|
crun: clean run
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf $(BUILD_DIR) $(DOC_DIR)
|
@rm -rf $(BUILD_DIR) $(DOC_DIR)
|
||||||
|
|
32
src/main.nim
32
src/main.nim
|
@ -1,12 +1,28 @@
|
||||||
## This module is a sample.
|
import strutils, sequtils #, strformat
|
||||||
|
|
||||||
import strutils
|
proc print_matrix(matrix: seq[seq[float]], row: int) =
|
||||||
|
for i in countup(1, row):
|
||||||
|
echo matrix[i-1]
|
||||||
|
|
||||||
proc helloWorld*(times: int) =
|
proc fill_matrix(matrix: var seq[seq[float]], row, col: int) =
|
||||||
## Takes an integer and outputs
|
for i in countup(1, row):
|
||||||
## as many indented "hello world!"s
|
for j in countup(1, col):
|
||||||
|
echo "Enter item in row:"
|
||||||
|
var entry: float = parseFloat(readLine(stdin))
|
||||||
|
matrix[i-1].add(entry)
|
||||||
|
matrix[i-1].delete(0)
|
||||||
|
echo matrix[i-1]
|
||||||
|
|
||||||
for i in 0 .. times-1:
|
echo "Enter number of rows:"
|
||||||
echo "hello world!".indent(2) # using indent to avoid `UnusedImport`
|
let row: int = parseInt(readLine(stdin))
|
||||||
|
|
||||||
helloWorld(5)
|
echo "Enter number of columns:"
|
||||||
|
let col: int = parseInt(readLine(stdin))
|
||||||
|
|
||||||
|
var matrix = newSeqWith(row, newSeq[float](col))
|
||||||
|
|
||||||
|
|
||||||
|
fill_matrix(matrix, row, col)
|
||||||
|
|
||||||
|
echo "\nMatrix entered is:"
|
||||||
|
print_matrix(matrix, row)
|
||||||
|
|
Loading…
Reference in a new issue