title: why bits sets are decreased after setting flag manipulator?
body: <h3>1</h3>
  <p><strong>Code</strong></p>
  <pre><code>#include&lt;iostream&gt;
  #include&lt;bitset&gt;
  int main()
  {
      
      std::ios_base::fmtflags flag=std::ios::showpos;
      
      std::cout&lt;&lt;std::cout.flags()&lt;&lt;&quot;\n&quot;;
      std::cout&lt;&lt;flag&lt;&lt;&quot;\n&quot;;
  
      std::cout.flags(flag);
      std::cout&lt;&lt;std::cout.flags()&lt;&lt;&quot;\n&quot;;
      
      std::cout&lt;&lt;59.20&lt;&lt;&quot;\n&quot;;
  
      std::cout&lt;&lt;std::bitset&lt;16&gt;(4098)&lt;&lt;&quot;\n&quot;;
      std::cout&lt;&lt;std::bitset&lt;16&gt;(2048)&lt;&lt;&quot;\n&quot;;
  }
  </code></pre>
  <p><strong>Output</strong></p>
  <pre><code>4098
  2048
  +2048
  +59.2
  0001000000000010
  0000100000000000
  </code></pre>
  <p>see here I set <code>showpos</code> flag manipulator and then I value returned by <code>cout.flags()</code> (current format setting) decreased bits set.</p>
  <h3>2</h3>
  <p><strong>Code</strong></p>
  <pre><code>#include&lt;iostream&gt;
  #include&lt;bitset&gt;
  int main()
  {
      
      std::cout&lt;&lt;std::cout.flags()&lt;&lt;&quot;\n&quot;;
      
      std::cout&lt;&lt;std::showpos;
      std::cout&lt;&lt;std::cout.flags()&lt;&lt;&quot;\n&quot;;
      
      std::cout&lt;&lt;59.20&lt;&lt;&quot;\n&quot;;
  
      std::cout&lt;&lt;std::bitset&lt;16&gt;(4098)&lt;&lt;&quot;\n&quot;;
      std::cout&lt;&lt;std::bitset&lt;16&gt;(6146)&lt;&lt;&quot;\n&quot;;
  }
  </code></pre>
  <p><strong>Output</strong></p>
  <pre><code>4098
  +6146
  +59.2
  0001000000000010
  0001100000000010
  </code></pre>
  <p>here as expected bits set value increased by <code>1</code> as I added one flag manipulator.</p>
  <p>Why when I set flag with help of <code>cout.flags()</code> function bit sets decrease rather than increase ?</p>