Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Output the whole value of a double

Reply
Thread Tools

Output the whole value of a double

 
 
bsmith1111@isp.com
Guest
Posts: n/a
 
      03-09-2006
I have a program that outputs the following to the screen (through
visual c++)
9999999999, which is stored in a double. I would like to keep the
number the way it is, but every time I output it (after converting it
to a cstring), it becomes 1e+010. I've tried many different formatting
ways, including stringstream formatting, sprintf(buffer, "%25.0fl",
temp) - temp is the double, sprintf(buffer, "%25f", temp), etc. I am
using the double number in a calculator I've been working on (CString
converted to chars for parsing, double result converted to string,
string converted to cstring for messagebox update), and I've been
unable to determine whether or not my many conversions were making this
a problem (unless I'm missing something, the conversions do not change
the display of the double - it's already like that). Can someone help
me output the whole number 9999999999 (and others), and not the
abbreviated 1e+010 form? Thanks for your help.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      03-09-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I have a program that outputs the following to the screen (through
> visual c++)
> 9999999999, which is stored in a double. I would like to keep the
> number the way it is, but every time I output it (after converting it
> to a cstring), it becomes 1e+010. I've tried many different formatting
> ways, including stringstream formatting, sprintf(buffer, "%25.0fl",
> temp) - temp is the double, sprintf(buffer, "%25f", temp), etc. I am
> using the double number in a calculator I've been working on (CString
> converted to chars for parsing, double result converted to string,
> string converted to cstring for messagebox update), and I've been
> unable to determine whether or not my many conversions were making this
> a problem (unless I'm missing something, the conversions do not change
> the display of the double - it's already like that). Can someone help
> me output the whole number 9999999999 (and others), and not the
> abbreviated 1e+010 form? Thanks for your help.
>


#include <iostream>
#include <ios>
#include <ostream>
#include <iomanip>

using namespace std;

int main()
{
double nines = 9999999999;
cout << fixed << setprecision(0) << nines << endl;
}


V
--
Please remove capital As from my address when replying by mail
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text box does not display the whole value navin ASP General 3 06-24-2009 04:02 PM
*WITHOUT* using: ValidateRequest="False" for the whole page (or my whole site).... \A_Michigan_User\ ASP .Net 2 08-21-2006 02:13 PM
How to check/validate whether the value is a whole number in C#? Siew Yee ASP .Net Web Controls 1 08-12-2005 11:02 PM
testing whether a double is a whole number David Marsh C Programming 3 07-03-2005 04:13 PM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM



Advertisments