#include <iostream.hvoid move(char getone,char putone){ cout<<getone<<"--"<m; cout<<"移动"<<m<<"盘子的方法:"<<endl; hanoi(m,'A','B','C');}要是您有TC的汉诺塔解法程序就麻烦贴给我,多谢

热心网友

void hanoi(int n,char a,char b,char c){if(n0){hanoi(n-1,a,c,b);printf("%d from %c to %c\n",n,a,c); hanoi(n-1,b,a,c);}}main(){int n;printf("\nPlease enter the number of tower:");scanf("%d",&n);printf("\n");hanoi(n,'a','b','c'); }

热心网友

递归经典例题