jjzjj

go - 为什么 Go 中的 fmt.Scanf 不等待用户输入?

我正在研究CalebDoxsey的Go书,我有两个关于fmt.Scanfhttp://www.golang-book.com/4的问题我想知道为什么程序在第二次Scanf后不停止并等待用户输入?以及如何测试用户是否输入了整数和/或没有留空?packagemainimport("fmt"//"math")//computesquarerootsbyusingNewton'smethodfuncmain(){varxfloat64//numbertotakesquarerootvaryfloat64//thisistheguessvarqfloat64//thisisthequotient
12