标签:格式 scan nic class ring pre names %s amp
func T(){
//ii, err := fmt.Scanf("%d--%s", &age, &Names)
//ii, err := fmt.Scanf("%d--%s\n", &age, &Names) //输入格式为: int--str
ii, err := fmt.Scanf("%d--%s\n", &age, &Names) // 不加\n后面的Scanf会报错
if err != nil{
fmt.Println(ii)
panic(err)
}
var x int64
var X string
ii, err = fmt.Scanf("%d--%s", &x, &X)
if err != nil{
fmt.Println(ii)
panic(err)
}
fmt.Println(ii)
fmt.Printf("x is :%d, X is %s\n", x, X)
fmt.Println(Names)
fmt.Println(age)
fmt.Println("end...")
}
标签:格式 scan nic class ring pre names %s amp
原文地址:https://www.cnblogs.com/lajiao/p/12256616.html