这是汉诺铁塔移动程序,请哪位大哥帮忙讲一下程序是如何实现的
void move(getone,putone)char getone,putone;
{printf("%c-->%c\n",getone,putone);}
void hanoi(n,one,two,three)
char one,two,three;
int n;
{if(n==1) move (one,three);
else
{hanoi(n-1,one,three,two);move(one,three);hanoi(n-1,two,one,three);}}
main()
{int m;
printf("input the number of diskes:");scanf("%d",&m);
printf("the step to moving %3d diskes:\n",m);
hanoi(m,'a','b','c');getch();}
这是汉诺铁塔移动程序,请哪位大哥帮忙讲一下程序是如何实现的,谢谢!