代码有些问题,请高手帮我修改一下呀。
#include
#include
#include
void hanoi(int n,initneedle,endneedle,tempneedle);
void hanoi(int n, initneedle, endneedle, tempneedle)
{
if(n==1)
{
cout<<"顺序:"< }
else
{
hanoi(n-1,initneedle,tempneedle,endneedle);
cout<<"顺序:"< hanoi(n-1,tempneedle,endneedle,initneedle);
}
}
int main()
{
int n;
string beginneedle="a";
middleneedle="b";
endneedle="c";
cout<<"请输入盘子的个数啊"< cin>>n;
cout<<"这是你输入盘子的个数啊"< cout< hanoi(n,beginneedle,endneedle,middleneedle);
system("pause");
return 0;
}
--------------------next---------------------
阅读(988) | 评论(0) | 转发(0) |