how to format it for scientific number output?

K

kathy

I have code:

std::stringstream sStream;
double pi = 3.14159;

....
sStream << pi; //?????????????
std::str = sStream.str(); //I want str show the scientific format.
 
V

Victor Bazarov

kathy said:
I have code:

std::stringstream sStream;
double pi = 3.14159;

...
sStream << pi; //?????????????
std::str = sStream.str(); //I want str show the scientific format.

See <ios> and 'std::scientific'.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,888
Messages
2,569,964
Members
46,293
Latest member
BonnieHamb

Latest Threads

Top