title: Convert a character array of binary numbers into a counter of Gray Code in C++
body: <p>is there any way to convert a char array of binary number into Gray Code. For example, I have the following code:</p>
  
  <pre><code>int j;
  char binaryNum[10], *pointer;
  /* From Hex convert to decimal */
  j = strtol( str, &amp;pointer, 16);
  /* From Decimal convert to Binary */
  itoa(j, binaryNum, 2);
  cout&lt;&lt;"Binary form of Y = "&lt;&lt;binaryNum&lt;&lt;"\n";
  </code></pre>
  
  <p>What i want is to convert this binaryNum into Gray Code, i.e change it one bit at a time. Can somebody please help me with the code ?
  forexample, i have a char binaryNum[10] == 101101
  and i want to convert it to gray code, i.e change only one bit at a time, like:
  101100
  101110
  101111
  something like  thiss..</p>