Skip to content

Instantly share code, notes, and snippets.

@junichiro
Created January 28, 2015 02:52
Show Gist options
  • Save junichiro/70b36d7f8f1213427d18 to your computer and use it in GitHub Desktop.
Save junichiro/70b36d7f8f1213427d18 to your computer and use it in GitHub Desktop.
code_iq: 1239
package main
import (
"fmt"
"os"
)
func main() {
v := GetInput()
fmt.Println(v)
}
func GetInput() [4][4]int {
var v[4][4]int
l := 0
for {
var a[4]int
i, err := fmt.Scanf("%d,%d,%d,%d\n", &a[0], &a[1], &a[2], &a[3])
if i == 4 {
for r := 0; r < 4; r++ {
v[l][r] = a[r]
}
} else if i == 0 {
break
} else {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
l++
}
return v
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment