// Program of tower of Hanoi //
#include"iostream.h"
#include"conio.h"
int main()
{
int n;
char beg='a',aux='b',end='c';
void tower(int,char,char,char);
clrscr();
cout<<"Enter the no. of disks:"; cin>>n;
tower(n,beg,aux,end);
getch();
return(0);
}
void tower(int n,char beg,char aux,char end)
{
if(n==1)
{
cout <<>" << end<<"\t"; return;
}
tower(n-1,beg,end,aux);
cout <<>" << end<<"\t";
tower(n-1,aux,beg,end);
}
#include"iostream.h"
#include"conio.h"
int main()
{
int n;
char beg='a',aux='b',end='c';
void tower(int,char,char,char);
clrscr();
cout<<"Enter the no. of disks:"; cin>>n;
tower(n,beg,aux,end);
getch();
return(0);
}
void tower(int n,char beg,char aux,char end)
{
if(n==1)
{
cout <<>" << end<<"\t"; return;
}
tower(n-1,beg,end,aux);
cout <<>" << end<<"\t";
tower(n-1,aux,beg,end);
}