하노이의 탑..^^ {{{~cpp #include 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 ); } } }}} ---- [데블스캠프2005], [하노이탑]