user84631: I want to divide two integers and get how often one of them fits into the other completely, so there will always be an integer as an output. In python you do this kind of operation with //.

user7508: In C++, the integer division operator is /, and the floating point
division is also /. The compiler chooses according to the types of the
operands:

if either or both operands are floating points numbers, you get a
floating point division

if both operands are of some integer type, you get an integer
division.


Thus:

5.0/2.0, 5.0/2, 5/2.0 all have the same value, namely 2.5

5/2 is 2.



84631: <p>I want to divide two integers and get how often one of them fits into the other completely, so there will always be an integer as an output. In python you do this kind of operation with <code>//</code>.</p>
 7508: <p>In C++, the integer division operator is <code>/</code>, and the floating point
division is also <code>/</code>. The compiler chooses according to the types of the
operands:</p>
<ul>
<li><p>if either or both operands are floating points numbers, you get a
floating point division</p>
</li>
<li><p>if both operands are of some integer type, you get an integer
division.</p>
</li>
</ul>
<p>Thus:</p>
<ul>
<li><p><code>5.0/2.0</code>, <code>5.0/2</code>, <code>5/2.0</code> all have the same value, namely <code>2.5</code></p>
</li>
<li><p><code>5/2</code> is <code>2</code>.</p>
</li>
</ul>
