C++ for calculating minimum moves in the Towers of Hanoi k peg problem without using recursion