就是用递归啊!

程序代码:
#include <iostream>
using namespace std;
void move(char x, char y )
{
cout<<x<<"->"<<y<<endl;
}
void hanio(int n,char one ,char two,char three)
{
if(n==1)
move(one,three);
else
{
hanio(n-1,one,three,two);
move(one,three);
hanio(n-1,two,one,three);
}
}
int main()
{
int m;
cout<<"please input the number of the hanio:"<<endl;
cin>>m;
cout<<"The steps of moving "<<m<<" disks"<<endl;
hanio(m,'A','B','C');
}