노 ..^^
~cpp
#include <iostream>
int answer=0;
void hanoi(int, int, int, int);
using namespace std;
void main()
{
int number;
cout << "노 블럭 개를 력 >>";
cin >> number;
hanoi (1,3,2,number);
cout << "답 "<< answer << "다.";
}
void hanoi(int from, int middle, int target, int num)
{
++answer;
if (1==num)
{
cout << from << "" << target << "로 깁다.\n";
}
else
{
hanoi (from, target, middle, num-1 );
cout << from << "" << target << "로 깁다.\n";
hanoi (middle, from, target, num-1 );
}
}










