【小白问题】 汉诺塔问题代码 求帮助理解 求释疑。
这是从书上Copy来的代码
程序代码:#include <stdio.h>
int main()
{
void hanoi(int n,char one,char two,char three);
int m;
printf("inputs the number of diskes:");
scanf("%d",&m);
printf("The steps to moveing %d diskes:\n",m);
hanoi(m,'A','B','C');
}
void hanoi(int n,char one,char two,char three)
{
void move(char x,char y);
if (n==1)
move(one,three);
else
{
hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}
}
void move(char x,char y)
{
printf("%c-->%c\n",x,y);
}
整个自定义函数hanoi这一段,else后面的部分不大懂。我笨。求高手们用最通俗的说法给俺讲下。谢谢、








