#include <conio.h>
int main(){
void hanoi(int n,char one,char two,char three);
int m;
printf("输入层数");
scanf("%d",&m);
printf("移动%d层的步骤为:\n",m);
hanoi(m,'A','B','C');
getch();
}
void hanoi(int n,char three){
void move(char x,char y);
if(n==1)
move(one,two);
else{
hanoi(n-1,one,two,three);
move(one,three);
hanoi(n-1,three);
}
}
void move(char x,char y){
printf("%c-->%c\n",x,y);
}