Tower of Hanoi using C++ and Java