//汉诺塔问题
#include<stdio.h>
int main()
{
void hanoi(int n, char one, char two, char three);
int m;
printf("input the number of diskes: ");
scanf("%d", &m);
hanoi(m, 'A', 'B', 'C');
}
//将n个盘子从"one"座借助"two"座移动到"three"座的过程
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);
}
}
//将1个盘子从x座移动到y座
void move(char x, char y)
{
printf("%c-->%c\n", x, y);
}