```
const result = "Polar radius =%.02f θ=%.02f° →Cartesian x = %.02f y =%.02f\n"
func interact(questions chan polar, answers chan cartesian) {
reader := bufio.NewReader(os.Stdin)
fmt.Println(prompt)
for{
fmt.Println("Radius and angle:")
line, err:= reader.ReadString('\n')
if err != nil{
break
}
var radius,θ float64
if _,err:= fmt.Sscan(line, "%f %f ",&radius,&θ); err != nil {
fmt.Println(os.Stderr, "invalid input")
fmt.Println("err=",err)
continue
}
questions <-polar{radius,θ}
coord := <-answers
fmt.Println(result, radius,θ,coord.x,coord.y )
}
fmt.Println()
}
```
编译执行时,在如下代码报错:
var radius,θ float64
if _,err:= fmt.Sscan(line, "%f %f ",&radius,&θ); err != nil {
fmt.Println(os.Stderr, "invalid input")
fmt.Println("err=",err)
continue
}
错误信息:
```
&{0xc42000a3a0} invalid input
err= type not a pointer: string
Radius and angle:
```
请大神指点
有疑问加站长微信联系(非本文作者)