i hvae this projecti need help with. We need to make a recursive tower of hanoi.
I have started on it and its going good so far. We have also been given the following code.
printf("Moving disc %d from Tower %d to Tower %d\n",
*(int*)dataPtr,
source == tower1 ? 1 : source == tower2 ? 2 : source == tower3 ? 3 : 0,
dest == tower1 ? 1 : dest == tower2 ? 2 : dest == tower3 ? 3 : 0);
pushStack(dest, dataPtr);
printTowers(); }
i undertstand all of that except the following
source == tower1 ? 1 : source == tower2 ? 2 : source == tower3 ? 3 : 0, dest == tower1 ? 1 : dest == tower2 ? 2 : dest == tower3 ? 3 : 0);
can someone help ??
MOD EDIT: When posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 04 September 2010 - 04:17 AM
Reason for edit:: Added code tags.

New Topic/Question
Reply




MultiQuote




|