title: Trying to convert C++ binary array to hexadecimal then print results
body: <p>I'm wanting to print an int array with 8 bytes and convert it to bin &amp; hex with the output as such: </p>
  
  <pre><code>0 00000000 00
  1 00000001 07
  ...
  </code></pre>
  
  <p>I've finished creating the binary convert function. I want to use the same function as the binary conversion -with an array, but check the left half with the right half and solve each different sided of the 8 bytes; left most -3 and right most is -7. 
  What am I doing wrong? I cannot figure out how to implement it and I know my hex function is all out of wack.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;math.h&gt;
  
  using namespace std;
  
  const int num = 8; //may not be needed -added for hex
  void Generatebinary(int arr[]);
  void GeneratehexDec(int arr[]);
  void print_binary(int arr[]); //haven't created yet
  int main()
  {
      int arr[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
      int i = 1;
      while (i &lt; 256)
      {
          Generatebinary(arr);
          print_binary(arr); //not created yet
          GeneratehexDec(arr);
          i++;
      }
  }
  
  void Generatebinary(int arr[])
  {
      for (int i = 7; i &gt; 0; i--)
      {
          if (arr[i] == 1)
              arr[i] = 0;
          else if (arr[i] == 0)
          {
              arr[i] = 1;
              break;
          }
      }
  }
  void GereatehexDec(int num)
  { //improper use
      int a;
      int i;
      int answer[] = { };
      a = num % 16;
      i++;
      answer[i] = num;
  
      for (int i = num; i &gt; 0; i--)
      {
          cout &lt;&lt; answer[i];
      }
      cout &lt;&lt; a;
  }
  </code></pre>