title: Conditional operator used in cout statement
body: <p>By trying, I came to know that it is necessary to put parentheses around a conditional operator in a cout statement. Here a small example:  </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main() {
    int a = 5;
    float b = (a!=0) ? 42.0f : -42.0f;
    // works fine
    std::cout &lt;&lt; b &lt;&lt; std::endl;
    // works also fine
    std::cout &lt;&lt; ( (a != 0) ? 42.0f : -42.0f ) &lt;&lt; std::endl;
    // does not work fine
    std::cout &lt;&lt; (a != 0) ? 42.0f : -42.0f;
  
    return 0;
  }
  </code></pre>
  
  <p>The output is: </p>
  
  <pre><code>42
  42
  1
  </code></pre>
  
  <p>Why are these parentheses necessary? The resulting type of the conditional operator is known in both cases, isn't it?</p>