我编的关于汉诺塔的小程序,有问题,我又找不到,帮忙看看,谢谢了!
#include<iostream.h>void hanoi(int count,int needle1,int needle2,int needle3)
{
if(count>0)
{
hanoi(count-1,needle1,needle2,needle3);
cout<<"move my disk "<<count<<" from "<<needle1<<" to "<<needle3<<endl;
hanoi(count-1,needle2,needle3,needle1);
}
}
main()
{
int c,n1,n2,n3;
cout<<"please enter the countNumber!"<<endl;
cin>>c;
hanoi(c,1,2,3);
}