Multipling multipal decimals

Dec 30, 2011 at 4:56pm
Help needed. I'm writing a simple code that computes metric and imperial measurements, however when I try this multiplication "output =(input*0.001)*0.001"
it gives me the answer in scientific notation "1e-006", but what I want to display is "0.000001"

Any help would be appreciated!
Dec 30, 2011 at 5:58pm
show your piece of code so i can have a better idea and test myself

try cout << showpoint << variable;
Last edited on Dec 30, 2011 at 5:59pm
Dec 31, 2011 at 4:54pm
I'll try that one also, but I found a solution. Here is a piece of the code:

if (unit == "J" || unit == "j" )
{
std::cout.precision(6);
output = input * 1;
std::cout<<"Wieght is "<<std::fixed<<output<<"(mg)\n";
}

I used "fixed" in my output statement to show the numbers in non-scientific form, or use "scientific"
instead of "fixed" to show your number and anything behind the decimal will be in scientific notation. Thx for your input though.
Topic archived. No new replies allowed.