473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to format it for scientific number output?

I have code:

std::stringstream sStream;
double pi = 3.14159;

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

Feb 28 '06 #1
1 1974
kathy wrote:
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
--
Please remove capital As from my address when replying by mail
Feb 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Woodster | last post by:
I am using the std::setprecision function to format variables of type double in a string however I am unsure how to stop this appearing in scientific notation. For example std::stringstream...
1
by: Nick | last post by:
Well, the project I am working on has now come to a screeching halt! I have been developing a program that heavily utilizes ADO.NET record sets. To generate reports, I convert the recordset to XML,...
2
by: Abhishek | last post by:
All, I am trying to export an access table to a text file. This table has a numeric field (Double) and when I export it to a text file, I see the number in the scientific format. MS-Access...
0
by: msnews.Microsoft.com | last post by:
Hi , Not able to figure out the way to format numeric fields. Code snippet Dim ColStyle3 As New DataGridTextBoxColumn With ColStyle3
9
by: Joe Attardi | last post by:
Hi all, Math is not my strongest area so forgive me if I use some of the wrong terminology. It seems that scientific notation is immune to rounding errors. For example: (4.98 * 100) + 5.51 ...
3
by: Wing | last post by:
Hello eveyone, I am programming some scientific computation based on C++. I would like to set every output/input (e.g. cout, io file stream) to be a high precision. What C++ command should I...
2
by: Robert Ludig | last post by:
When I format a number to a string in scientific notation: string.Format("{0:E}",20000); I get the following string (culture de-DE): 2,000000E+003 How can I format scientific notation in...
4
by: john | last post by:
I am reading TC++PL3, and on page 468, at "21.4.3 Floating-Point Output", it formats floating point output in the style: cout.setf(ios_base::scientific, ios_base::floatfield); // use scientific...
3
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, By default, the "g" format specifier seems to use 2 digits in the exponent if it decides to use the scientific format. I.e., Double.ToString("g"). How do I control the number of...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.