package main
import (
"fmt"
"strconv"
)
func main() {
var m map[int]map[int]string
m = make(map[int]map[int]string)
for i := 0; i < 10; i++ {
m[i] = make(map[int]string)
for j := 0; j < 3; j++ {
m[i][j] = "(" + strconv.Itoa(i) + "+" + strconv.Itoa(j) + ")"
}
}
//打印结果
for i := 0; i < 10; i++ {
for j := 0; j < 3; j++ {
fmt.Print(m[i][j])
fmt.Print(" ")
}
fmt.Println("\n")
}
}
Go语言中的map用法
最新推荐文章于 2024-07-21 21:57:54 发布