HEX to BIN convert
<p>I wrote 2 programs that converts HEX to DEC and DEC to BIN.
When i test them seperatly they work.
When i place them together it outputs the right DEC code but the wrong BIN code.
How can i fix this?</p>

<h1>HEX to DEC</h1>

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

int main()
{
int hex;
std::cin &gt;&gt; std::hex &gt;&gt; hex;
std::cout &lt;&lt; hex &lt;&lt; std::endl;
system("pause");
return 0;
}
</code></pre>

<h1>DEC to BIN</h1>

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

using namespace std;

int main ()
{   

int Number;
cin &gt;&gt; Number;
bool Binary[sizeof(int) * CHAR_BIT];
for(unsigned int i = 0; i &lt; sizeof(int) * CHAR_BIT; i++)
Binary[(sizeof(int) * CHAR_BIT - 1) - i] = Number &amp; (1 &lt;&lt; i);
for(unsigned int i = 0; i &lt; sizeof(int) * CHAR_BIT; i++)
  std::cout &lt;&lt; Binary[i];
std::cout &lt;&lt; endl;

system ("pause");

return 0;

}
</code></pre>

<h1>HEX to BIN</h1>

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

int main()
{
int hex = 0;
int Number = 0;

std::cin &gt;&gt; std::hex &gt;&gt; hex;
std::cout &lt;&lt; hex &lt;&lt; std::endl;

hex = Number;

bool Binary[sizeof(int) * CHAR_BIT];
for(unsigned int i = 0; i &lt; sizeof(int) * CHAR_BIT; i++)
Binary[(sizeof(int) * CHAR_BIT - 1) - i] = Number &amp; (1 &lt;&lt; i);
for(unsigned int i = 0; i &lt; sizeof(int) * CHAR_BIT; i++)
  std::cout &lt;&lt; Binary[i];
std::cout &lt;&lt; std::endl; 
system("pause");
return 0;
}
</code></pre>
