标题:汉诺塔小程序
取消只看楼主
zfxheb123
Rank: 1
来 自:山东济宁
等 级:新手上路
帖 子:23
专家分:0
注 册:2008-4-30
结帖率:100%
 问题点数:0 回复次数:0 
汉诺塔小程序
#include"string.h"
#include"stdio.h"

 char move(char getone,char putone)
{
   printf("%c-->%c\n",getone,putone);

}
 char hanoi(int n,char one,char two,char three)
{
if(n==1)
move(one,three);
else
{
 hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}

}

main()
{

char haoni(int,char,char,char);
int m=3;
char one,two,three;
one=getchar();two=getchar();three=getchar();
hanoi(m,one,two,three);


}



#include"string.h"
#include"stdio.h"

 char move(char getone,char putone)
{
   printf("%c-->%c\n",getone,putone);

}
 char hanoi(int n,char one,char two,char three)
{
if(n==1)
move(one,three);
else
{
 hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}

}

main()
{

char haoni(int,char,char,char);
int m=3;
char one,two,three;
one=getchar();two=getchar();three=getchar();
hanoi(m,one,two,three);


}









#include"string.h"
#include"stdio.h"

 char move(char getone,char putone)
{
   printf("%c-->%c\n",getone,putone);

}
 char hanoi(int n,char one,char two,char three)
{
if(n==1)
move(one,three);
else
{
 hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}

}

main()
{

char haoni(int,char,char,char);
int m=3;
char one,two,three;
one=getchar();two=getchar();three=getchar();
hanoi(m,one,two,three);


}
搜索更多相关主题的帖子: 汉诺塔 char three one 
2008-05-03 18:35



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




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

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