#include <iostream.hvoid move(char getone,char putone){ cout<<getone<<"--"<m; cout<<"移動"<<m<<"盤子的方法:"<<endl; hanoi(m,'A','B','C');}要是您有TC的漢諾塔解法程序就麻煩貼給我,多謝
熱心網(wǎng)友
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'); }
熱心網(wǎng)友
遞歸經(jīng)典例題