J
jeff_j_dunlap
I am trying to display some numbers but they are displaying in e-
notation as seen in the output below.
double a = 500000;
double b = 1400000;
cout << "a = " << a << endl; // prints "a = 500000"
cout << "b = " << b << endl; // prints "b = 1.4e+006"
Here is the actual reason for my concern. From within my web
application the output being displayed in notated form as well:
// double to string conversion
std::string DoubleToStr(double x)
{
std:stringstream o;
if ((o << x))
return o.str();
else
return "";
}
// convert and output string value
cout << DoubleToString(a); // prints "a = 500000"
cout << DoubleToString(b); // prints "b = 1.4e+006"
Would someone tell me how not to display the data in notated form?
Thank you,
Jeff
notation as seen in the output below.
double a = 500000;
double b = 1400000;
cout << "a = " << a << endl; // prints "a = 500000"
cout << "b = " << b << endl; // prints "b = 1.4e+006"
Here is the actual reason for my concern. From within my web
application the output being displayed in notated form as well:
// double to string conversion
std::string DoubleToStr(double x)
{
std:stringstream o;
if ((o << x))
return o.str();
else
return "";
}
// convert and output string value
cout << DoubleToString(a); // prints "a = 500000"
cout << DoubleToString(b); // prints "b = 1.4e+006"
Would someone tell me how not to display the data in notated form?
Thank you,
Jeff