"John Harrison" <> wrote in message
news:...
>
> "Ville Ahonen" <> wrote in message
> news:aQ4dd.3829$.. .
> > I'm a total beginner at C++ so please bear with me.. When i write
> >
> > cout << stddev * stddev << endl;
> >
> > I get the output "4.49513e-05". How can I rephrase the above so that I
> > would instead get the output "0.000049513"?
> >
>
> cout << fixed << stddev*stddev << endl;
To elaborate:
You can also use 'setprecision(n)' to control the
number of digits after the decimal point.
'std::fixed' is declared by <ios>, and
'std::setprecision()' is declared by <iomanip>
-Mike
|