} void hanoi(int n,char one ,char two ,char three)//把n个盘子从 one借助two移动到t here { void move(char a,char b); if(n==1) move(one,three); else { hanoi(n-1,one,three,two);//把n-1个盘子 从 one借助there移动到two move(one,three); hanoi(n-1,two,one,three);//把n-1个盘子 从 two借助one移动到there } } void move(char a,char b) { printf("%c-->%c\n",a,b); }
可以这么理解,它就是一个递归的调用
图片倒过来看啊,新手求照啊