Here I am supposed to implement only the function which will print the instructions to move plates.
void hanoi(int n,char source,char temp,char dest){ if(n>0){ hanoi(n-1,source,dest,temp); printf("move plate from %c to %c",source,dest); hanoi(n-1,temp,source,dest); } }If you have read my previous post, I think you can understand this function. Feel free to use this code. Enjoy hanoi tower. Try this function with n=32. You will understand how slow your computer is. Good Luck!
No comments:
Post a Comment