how to convert decimal to binary in c++
<p>I have a method to convert dec to bin </p>

<pre><code>QList&lt;bool&gt; widgetInput::decToBin(int number)
{
        int remainder;
        QList&lt;bool&gt; result;
        if(number &lt;= 1) {
            result &lt;&lt; number;
            return result;
        }

        remainder = number%2;
        decToBin(number &gt;&gt; 1);
        result &lt;&lt; remainder;


}
</code></pre>

<p>but unfortunately this method only holds one element in list .
but when I replace the "result &lt;&lt; number" with "cout &lt;&lt; number"
it will work.
could you please help me and let me know where is my exact problem?</p>

<p>regards.</p>
