Convert scientific notation to decimal
<p>I'm trying to do the challenge on <a href="http://www.cstutoringcenter.com/problems/problems.php?id=2" rel="nofollow">http://www.cstutoringcenter.com/problems/problems.php?id=2</a> and I'm having problems converting scientific notation to decimal notation, which I need to add the exponent together:</p>

<p>Here is my code so far:</p>

<pre><code>#define FIRST 2
#define SECOND 20

#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;sstream&gt;
#include &lt;iomanip&gt;

using namespace std;

int main()
{
    // Give variables initial setting
    int total = 0;
    float powanswer = 0;

    // Get rid of scientific notation for large numbers
    stringstream ss;
    ss.setf(ios::fixed);
    ss &lt;&lt; pow(FIRST,SECOND);
    ss &gt;&gt; powanswer;


    // Output
    // Expected: 2^20 = 1048576 =&gt; 1+0+4+8+5+7+6 =&gt; 31
    // Outcome: 2^20 = 1.04858e+06  =&gt; 1+.+0+4+8+5+8+e+++0+6 =&gt; 32
    cout &lt;&lt; FIRST &lt;&lt; "^" &lt;&lt; SECOND &lt;&lt; " = " &lt;&lt; powanswer &lt;&lt; "  =&gt; ";


    // Convert power int to string
    string ResultText = "";
    stringstream convert;
    convert &lt;&lt; powanswer;
    ResultText = convert.str();

    // Loop over total
    for (int x=0; x&lt;ResultText.size(); x++)
    {

        // Convert character to integer
        int ResultNum = 0;
        stringstream convert;
        convert &lt;&lt; ResultText[x];
        convert &gt;&gt; ResultNum;
        total+=ResultNum;

        // Output
        cout &lt;&lt; ResultText[x];
        ResultText.size()-1 == x ? cout &lt;&lt; " =&gt; " : cout &lt;&lt; "+";

    }
    cout &lt;&lt; total &lt;&lt; endl;
    return 0;
}
</code></pre>

<p>I've tried searching everywhere on how to convert it, and I read I can use &lt;&lt; fixed &lt;&lt; on the stream, or .setf(ios::fixed) but neither seems to be working for me and I'm not sure what I'm doing wrong.</p>

<p>As marked in the code, here is the current output:</p>

<pre><code>2^20 = 1.04858e+06  =&gt; 1+.+0+4+8+5+8+e+++0+6 =&gt; 32
</code></pre>

<p>What I want and expect to see is:</p>

<pre><code>2^20 = 1048576 =&gt; 1+0+4+8+5+7+6 =&gt; 31
</code></pre>

<p>Edit: Spelling mistake</p>
