标题:我编的关于汉诺塔的小程序,有问题,我又找不到,帮忙看看,谢谢了!
取消只看楼主
knight_010
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-4-11
 问题点数:0 回复次数:0 
我编的关于汉诺塔的小程序,有问题,我又找不到,帮忙看看,谢谢了!
#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);
}
搜索更多相关主题的帖子: 汉诺塔 
2007-04-11 15:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-131031-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.355055 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved