数据结构C/C++语言

来源:百度知道 编辑:UC知道 时间:2024/06/04 08:06:13
有意回答者请发我消息,谢谢!
两道作业,小生比较废柴,来不及做了,望高手帮助!

第二题答案,第一题没看清要求。
#include<stdio.h>
void main()
{
void hanoi(int i,char one,char two,char three);
int m;
printf("please input the number of diskes\n");
scanf("%d",&m);
printf("the step to moving %d diskes :\n",m);
hanoi(m,'A','B','C');
}
void hanoi(int n,char one,char two,char three)
{
void move(char x,char y);
if(n==1)
move(one,three);
else
{
hanoi(n-1,one,two,three);
move(one,three);
hanoi(n-1,two,one,three);
}
}
void move(char x,char y)
{
printf("%c-->%c\n",x,y);
}

先给题吧,小弟也是才学数据结构一课,若能帮忙我一定好好写。