How would I get 1960.00 - 666.40 = 1293.60 in a C++ program?? I don't want it to round the numbers. I tried:
cout << fixed << showpoint << setprecision (2);
but it did not work.
This is a discussion on Decimals in C++ within the C++ Programming forums, part of the General Programming Boards category; How would I get 1960.00 - 666.40 = 1293.60 in a C++ program?? I don't want it to round the ...
How would I get 1960.00 - 666.40 = 1293.60 in a C++ program?? I don't want it to round the numbers. I tried:
cout << fixed << showpoint << setprecision (2);
but it did not work.
Last edited by slimdime; 09-02-2010 at 07:41 PM.
std::cout << 1960.0 - 666.4 << std::endl;
Should work.
Code?
(Beware of inaccuracies.)
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
That worked!! Thanks Elysia.