The Towers of Hanoi

In an ancient city in India, so the legend goes, monks in a temple have to move a pile of 64 sacred disks from one location to another. The disks are fragile; only one can be carried at a time. A disk may not be placed on top of a smaller, less valuable disk.
And, there is only one other location in the temple (besides the original and destination locations) sacred enough that a pile of disks can be placed there. So, the monks start moving disks back and forth, between the original pile, the pile at the new location, and the intermediate location, always keeping the piles in order (largest on the bottom, smallest on the top). The legend is that, before the monks make the final move to complete the new pile in the new location, the temple will turn to dust and the world will end. Is there any truth to this legend?
The Tower of Hanoi puzzle was invented by the French mathematician Edouard Lucas in 1883. The puzzle is well known to students of Computer Science since it appears in virtually any introductory text on data structures or algorithms. The goal is to move all the discs from the left peg to the right one, obeying the following rules:
- Only one disk may be moved at a time.
- Each move consists of taking the upper disk from one of the pegs and sliding it onto another peg, on top of the other disks that may already be present on that peg.
- No disk may be placed on top of a smaller disk.
There are many recursive solutions to this problem, here are two non-recursive solutions. One is by Prasad Krishna and the other one I found somewhere on the web, some time ago (sorry for not crediting you, please leave a comment if it is your code
)




using namespace std;
int main()
{
int st[20][4],top,o=1,m=2,d=3,n, i,j,k;
top=0;
cout << “How many disks?” << endl;
cin >> n;
st[top][0]=o;
st[top][1]=d;
st[top][2]=m;
st[top][3]=n;
while(top>=0)
{
i=st[top][0];
j=st[top][1];
k=st[top][2];
n=st[top][3];
top=top-1;
if(n<=1)
cout << “Move “ << i << ” to “ << j << endl;
else if(n>1)
{
top=top+1;
st[top][0]=k;
st[top][1]=j;
st[top][2]=i;
st[top][3]=n-1;
top=top+1;
st[top][0]=i;
st[top][1]=j;
st[top][2]=0;
st[top][3]=0;
top=top+1;
st[top][0]=i;
st[top][1]=k;
st[top][2]=j;
st[top][3]=n-1;
}
}
}



honai is in Vitetnam not in india
please help me to write this problem(hanoi)in C language graphically
i got a recursive code if you want to publish it?
Yeah, Hanoi is the Social republic of Vietnam ’s capital.
Well, think about it. /ancient/
i’m not sure, but possibly india controlled what is now vietnam at one point.
Vietnam has been controlled by China a few times, and sacked by Mongols once, but never invaded by India, to my knowledge. The name is irrelevant anyway, there are a dozen ways it could have gotten the name and probably several namesakes it could have gotten it from.
On topic, I find the tower fascinating. It is cool.