Towers of Hanoi, special output.

I have the classic Towers of Hanoi problem for homework. The code works. Here is my output for 3 disk:

Code:

`move disk from peg 1 to peg 2.`

move disk from peg 1 to peg 3.

move disk from peg 2 to peg 3.

move disk from peg 1 to peg 2.

move disk from peg 3 to peg 1.

move disk from peg 3 to peg 2.

move disk from peg 1 to peg 2.

Press any key to continue

However, the homework assignment calls for specialized output exactly like this (and I can't figure this part out):

Code:

`move disk 1 from peg 1 to peg 2.`

move disk 2 from peg 1 to peg 3.

move disk 1 from peg 2 to peg 3.

move disk 3 from peg 1 to peg 2.

move disk 1 from peg 3 to peg 1.

move disk 2 from peg 3 to peg 2.

move disk 1 from peg 1 to peg 2.

Press any key to continue

And of course, here is the obvious recursive solution to the problem:

Code:

`#include<stdio.h>`

void moveDisk(int disk, int fromPeg, int toPeg, int workPeg)

{

if(disk == 1)

{

printf("move disk from %d to %d.\n", fromPeg, toPeg);

}

else

{

moveDisk(disk - 1, fromPeg, workPeg, toPeg);

moveDisk(1, fromPeg, toPeg, workPeg);

moveDisk(disk - 1, workPeg, toPeg, fromPeg);

}

}

int main(int argc, char *argv[])

{

moveDisk(3, 1, 2, 3);

return 0;

}

I've tried lots of things and can't get it to keep track of what disk its moving. =\

thanks