如何用Go语言实现汉诺塔算法
package main import ( "fmt" ) func print(n int,x rune,y rune)(){ fmt.Printf("moving disk %d from pole %c to pole %c\n",n,x,y) } func move(n int,a rune,b rune,c rune)(){ if n==1{ print(n,a,c) }else { move(n-1,a,c,b); print(n,a,c); move(n-1,b,a,c) } } func main() { var n int; fmt.Println("Please input the disk number n: "); fmt.Scanf("%d",&n); move(n,'x','y','z') }