大家一起来讨论一下
#include<iostream> //汉诺塔问题using namespace std;
void main()
{
int n;
void hanoi(int n,char a,char b,char c);
cout<<"please input the number of disks to be moved:"<<endl;
cin>>n;
hanoi(n,'a','b','c');
}
void hanoi(int n,char a,char b,char c)
{
if(n>0)
{
hanoi(n-1,a,c,b);
cout<<"\nMove disc "<<n<<" from pile "<<a<<" to "<<b;
hanoi(n-1,c,b,a);
}
}
这程序看的不是明白````有谁能帮我解释一下``谢谢了在此``````