decimal formatting with more elegance C++
<p>I have this code:</p>

<pre><code>            void FeetInches::decimal() 
            {
                if (inches == 6.0)
                {
                    inches = 5;
                    std::cout &lt;&lt; feet &lt;&lt; "." &lt;&lt; inches &lt;&lt; " feet";  //not the best but works..
                }
            }
</code></pre>

<p>This will print something like 12 feet 6 inches as 12.5 feet.  I would prefer to not use this "hackish" method and make it like this:</p>

<pre><code>            void FeetInches::decimal() 
            {
                if (inches == 6.0)
                {
                    inches = .5;
                    std::cout &lt;&lt; feet &lt;&lt; inches &lt;&lt; " feet";  //not the best but works..
                }
            }
</code></pre>

<p>But this will print 60.5 inches (I need 6.5 inches).  Basically if I print inches alone it prints 0.5.  I want inches to print only .5 without the zero.  Cant a printf method or another quick technique implement this?  The data types are double by the way</p>
