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. 1 4299 bs********@isp.com 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill Sneddon |
last post by:
Can any one tell me how to output the following string?
<%response.write "<tr><td><a href=""file://SERVER/mmlogs/TNAME" &
yearmonth & """>"& "MYJUNK" & "</a><BR></td></tr>" %>
...
|
by: Carramba |
last post by:
hi!
I am wondering if the is a way to get %f work intuitive, supose I
caclulate division of 2 double's and I wan't to get nice output, in case
it only one decimal I want to print only one.. and...
|
by: David Marsh |
last post by:
The program calculates the continued fraction representation of the input:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv)
{
double diff, n, r, i;
if(argc != 2)...
|
by: Juan Sutton |
last post by:
I'm building a web service and trying to get an output similar to
this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>...
|
by: Nena |
last post by:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.
But so far I've failed.
Therefore I've copied all head-files (for example nr.h)
into the folder...
|
by: Blah |
last post by:
Hi, this is a small program to print out three lists of values. One is
a simple increment count the others are values from two equations. I've
run this without problems before but when I've put in...
|
by: Stephen3776 |
last post by:
I am doing an inventory control progam and trying to output a multiple array, I am getting an illegal conversion error java.lang.double !d. Can somebody tell me what I am doing wrong or if there is...
|
by: dwaterpolo |
last post by:
Hi Everyone,
I am trying to read two text files swY40p10t3ctw45.col.txt and solution.txt
and compare them, the first text file has a bunch of values listed like:
y
y
y
y
y
y
y
|
by: pereges |
last post by:
I have a C program which I created on Windows machine. I have compiled
and executed the program on windows machine and it gives me the
consistent output every time i run it. for eg.
input a = 2,...
|
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$) {
}
...
|
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...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |