Major : TMD
Hello professor this video with code is create tower game :
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int m;
void hanoi(int n, char a, char b, char c);
printf("Enter the number of discs>");
scanf_s("%d",&m);
printf("Step-by-step removal of discs: \n");
hanoi(m,'1','2','3');
system("pause");
return 0;
}
void hanoi(int n, char x, char y, char z)
{
if(n==1)
printf("Move the top disk from pole % c to pole %c \n",x,z);
else
{
hanoi(n-1,x,z,y);
hanoi(1,x,y,z);
hanoi(n-1,y,x,z);
}
}
This is my link : http://www.youtube.com/watch?v=KfuUHfXSEik&feature=youtu.be
No comments:
Post a Comment