#include <stdio.h>
/************************************************************************/
/* 汉诺塔: 将n个盘从one座借助two座,移到three座 */
/************************************************************************/
void hanoi_Example (void)
{
int m;
printf("input the number of diskes:");
scanf("%d",&m);
printf("The step to move %d diskes:\n",m);
hanoi(m,'A','B','C');
}
void hanoi(int n,char one,char two,char three)
{
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);
}
int main ()
{
hanoi_Example();
return 0;
}