#include<iostream>
#include<stdlib.h>
using namespace std;
void movedisks(int n,char a,char b,char c);
main()
{int ch,n;
cout<<"\nConsidering source peg is A and destination peg is C\n";
cout<<"And the top most disk is the smallest and is numbered as 1\n";
cout<<"\n1.Play\n2.Exit\n";
while(1)
{cout<<"Enter choice : ";
cin>>ch;
switch(ch)
{
case 1 : cout<<"\nenter the number of disks : ";
cin>>n;
movedisks(n,'A','B','C');
cout<<"\nFINISHED!!!\n\n";
break;
case 2 : exit(0);
}
}
};
void movedisks(int n , char a,char b, char c)
{
if(n>=1)
{
movedisks(n-1,a,c,b);
cout<<"\nMove disk "<<n<<" from peg "<<a<<" to peg "<<c<<endl;
movedisks(n-1,b,a,c);
}
}