标题:这是汉诺铁塔移动程序,请哪位大哥帮忙讲一下程序是如何实现的
只看楼主
longshifeng
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2005-4-25
 问题点数:0 回复次数:0 
这是汉诺铁塔移动程序,请哪位大哥帮忙讲一下程序是如何实现的
void move(getone,putone)
char getone,putone;
{printf("%c-->%c\n",getone,putone);}
void hanoi(n,one,two,three)
char one,two,three;
int n;
{if(n==1) move (one,three);
else
{hanoi(n-1,one,three,two);move(one,three);hanoi(n-1,two,one,three);}}
main()
{int m;
printf("input the number of diskes:");scanf("%d",&m);
printf("the step to moving %3d diskes:\n",m);
hanoi(m,'a','b','c');getch();}
这是汉诺铁塔移动程序,请哪位大哥帮忙讲一下程序是如何实现的,谢谢!
搜索更多相关主题的帖子: 汉诺铁塔 
2005-05-18 17:16



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




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

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