here's the code hunny ...
it took me 4 hours to get it ...tracing this code is like hell
# include <iostream.h>
# .....
void towers(int n,char frompeg,char topeg,char auxpeg)
{
if(n==1) //if only one disk just make the move and return
{
cout<<"\n"<<"move disk 1 from peg"<<frompeg<<"to peg"<<topeg<<"\n";
return;
}
towers(n-1,frompeg,auxpeg,topeg);
cout<<"\n"<<"move disk"<<" "<<n<<"from peg"<<frompeg<<"to peg"<<topeg<<"\n;
towers(n-1,auxpeg,topeg,frompeg);
}
void main()
{ int n;
cout<<"enter no of disks 2 be moved "<<endl;
cin>>n;
towers(n,'A','C','B');
getch();
}