putting 2 programs together
<p>i made 2 programs.
first one converts a HEX to a dec.
second one converts a dec to a bin.</p>

<p>now i want to put them together that first converts a hex to dec and then from dec to bin
but how can i do that?</p>

<p>thanks.</p>

<p>HEX to dec</p>

<pre><code>#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;

void decToBin( int, int );
int main(void)
{


char s[] = "ff";
unsigned long x;
x = strtoul(s, 0, 16);
printf("%s"
"%lu"
"\n"
, s, x, x, x);

system ("pause");
return 0;
}
</code></pre>

<p>dec to bin</p>

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

using namespace std;

void decToBin( int, int );

int main()
{
int decimal;
cin &gt;&gt; decimal;  
decToBin( decimal, 2 ); 
system  ("pause");
return 0; 
}
void decToBin(int num, int base)
{
if (num &gt; 0)
{
    decToBin(num/base, base);
    cout&lt;&lt; num % base;
}
}
</code></pre>
