c++ input in std::cout in the same line
<p>What works:</p>

<pre><code>double a1;
a1 = 2+4;
std::cout &lt;&lt; a1;
</code></pre>

<p>What I want it to be:</p>

<pre><code>double a1;
std::cin &gt;&gt; a1;
std::cout &lt;&lt; a1;
</code></pre>

<p>But when I type 2+4, I get the output 2, then 4, I want it to sum at once.</p>