#include <iostream. h> #include strclass. h void Hanoi (int n, String A, String B, String C)i /解决汉诺塔问题的算法 if(n-1) cout<<move<<a<<to <<C<< endl else( Hanoi(n-1,A, C,B); cout << move <<a<< to <<c << endl Hanoi(n-1,B,A,C);#include <iostream.h> #include "strclass.h” void Hanoi (int n, String A, String B, String C) { //解决汉诺塔问题的算法 if ( n == 1 ) cout << " move " << A << " to " << C << endl; else { Hanoi ( n-1, A, C, B ); cout << " move " << A << " to " << C << endl; Hanoi ( n-1, B, A, C ); } }