This is an old school :) divide & conquer problem. Try looking at this code: void hanoi(int diskSize, int source, ...
stackoverflow.com