title: How to use std::ostringstream to check the output?
body: <p>I made code below to check the output.</p>
  <pre><code>ostringstream oss;
      Fraction f12{1, 2};
      oss &lt;&lt; &quot;fraction f12 is &quot; &lt;&lt; f12 &lt;&lt; '\n';
      string result = oss.str();
      cout &lt;&lt; result &lt;&lt; '\n';
      std::string expected{ &quot;fraction f12 is 1/2\n&quot; };
      cout &lt;&lt; expected &lt;&lt; endl;
      if(oss.str() == expected)
          cout &lt;&lt; &quot;The strings match...\n&quot;;
      else
          cout &lt;&lt; &quot;The strings don't match.\n&quot;;
  </code></pre>
  <p>However, the output is below</p>
  <pre><code>fraction f12 is 1/2
  
  
  fraction f12 is 1/2
  
  The strings don't match.
  </code></pre>
  <p>I think f12 is cause, but I do not have idea.
  How can I make it &quot;The strings match...&quot;?</p>