How do I divide two integers inside a double variable?
<p>I am working on a lab for school that runs 10 trails of 10000 5 card hands. I have to find flushes and pairs in each hands. I have to find the percentage of pairs and flushs per trail.</p>

<p>My problem is when I try to get the percentage of a pair of one trail for example </p>

<pre><code>double percent =  total_pairs/10000;
</code></pre>

<p>or </p>

<pre><code>double percent = 5600/10000;
</code></pre>

<p>my output becomes 0 when I want to print out 2 decimal places I get the following </p>

<pre><code>0.00
</code></pre>

<p>using this code </p>

<pre><code>cout&lt;&lt;setiosflags(ios::fixed | ios::showpoint);
cout&lt;&lt;setprecision(2)&lt;&lt;percent&lt;&lt;endl;
</code></pre>

<p>but I still get zero I get actual numbers when I cast it like so </p>

<pre><code>double percent = (double) 5600/10000;
</code></pre>

<p>is this correct because I don't want it to truncate my outputs or am I missing something </p>

<p>Hope you can understand me.</p>
