Tower of hanoi problem
<p>Hi Guys I am faced with a problem on tower of hanoi:<br>
we are given a stack of cylinders of alternate colors stacked over one another alternately.<br>The job is to separate the two stacks of same colour<br>
I could write the code(algorithm) for a regular tower of hanoi using recursion, but I am not able to figure out this part. Can some one help?<br>
Code for regular hanoi problem:<br></p>

<pre><code>#include&lt;iostream&gt;

using namespace std;
int count=0;

void hanoi(char a,char b,char c,int x)
{
  if(x&gt;1)
  {
    hanoi(a,c,b,x-1);
    hanoi(a,b,c,1);
    hanoi(c,b,a,x-1);
  }
  else
  {
    cout&lt;&lt;"Move a Disk from "&lt;&lt;a&lt;&lt;" to "&lt;&lt;b&lt;&lt;endl; count++;  
  }
}

int main()
{
  int n;
  cout&lt;&lt;"Enter the height of stack";
  cin&gt;&gt;n;
  hanoi('A','B','C',n);
  cout&lt;&lt;"\nNo. of changes done:"&lt;&lt;count;

  return 0;
}
</code></pre>
