matrix generation
This commit is contained in:
parent
8c32723c10
commit
2abbdbb61b
1 changed files with 25 additions and 0 deletions
25
main.go
Normal file
25
main.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Matrix [][]int
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
height, err := strconv.Atoi(os.Args[1])
|
||||||
|
if err != nil {
|
||||||
|
panic("height not valid")
|
||||||
|
}
|
||||||
|
width, err2 := strconv.Atoi(os.Args[2])
|
||||||
|
if err2 != nil {
|
||||||
|
panic("width not valid")
|
||||||
|
}
|
||||||
|
Matrix = make([][]int, height)
|
||||||
|
for i := range Matrix {
|
||||||
|
Matrix[i] = make([]int, width)
|
||||||
|
}
|
||||||
|
fmt.Println(Matrix)
|
||||||
|
}
|
Reference in a new issue