// 这是一个非常经典的递归问题
// 虽然简单,但既然讲到递归就不得不提
#include "iostream.h"
void move( char from , char to )
{
static int step = 1;
cout<<"step "<<step++<<": "<<from<<" -> "<<to<<endl;
}
void hanoi( int n , char a , char b , char c )
{
if( n > 0 )
{
hanoi( n - 1 , a , c , b );
move( a , c );
hanoi( n - 1 , b , a , c );
}
}
void main()
{
hanoi( 21 , 'a' , 'b' , 'c' );
}