#include <stdio.h>
void move(int n, char A, char B,char C)
{
if(n==1)
printf("Move disk %d from %c to %c\n", n, A, C);
else
{
move(n-1, A, C, B);
printf("Move disk %d from %c to %c\n", n, A, C);
move(n-1, B, A, C);
}
}
int main()
{
int n;
scanf("%d",&n);
move(n,'A','B','C');
return 0;
}
总结:看了老师的也不太明白,要多练习