#include <iostream> using namespace std; int main() { void hanno(int ,char ,char,char); int n; cin>>n; hanno(n,'A','B','C'); return 0; } void hanno(int n,char A,char B,char C) { if(n==1) cout<<"Move disk "<<n<<" from "<<A<<" to "<<C<<endl; else { hanno(n-1,A,C,B); cout<<"Move disk "<<n<<" from "<<A<<" to "<<C<<endl; hanno(n-1,B,A,C); } }汉诺塔讲解