多个fmt.Scanf 输入值的问题
/* Go 程序的基本结构 */
/* Go 程序的基本结构 */
package main
import "fmt"
type Moon struct {
stock int
}
func main(){
var N,Need int
var List [] Moon
// var MaxSale float64 = 0
// var NeedF float64 = 0
fmt.Scanf("%d %d",&N,&Need)
fmt.Printf(">> %d %d \n",&N,&Need)
fmt.Printf("002>> %d %d \n",N,Need)
List = make([]Moon,N)
// NeedF = float64(Need)
for i := 0 ;i < N;i ++{
fmt.Scanf("%f",&List[i].stock)
}
for i :=0 ;i < N;i ++ {
fmt.Println("输出List[i]",List[i].stock)
}
}
输入: 3 4 5 6 7
输出:
>> 824633794736 824633794744
002>> 3 5
输出List[i] 0
输出List[i] 0
输出List[i] 0
写入自己的博客中才能记得长久