std::setprecision
Hi!
I have a problem with std::setprecision. Lookt at this:
std::stringstream stream;
stream << std::setprecision(2) << std::fixed << Number[1] << " Euro | " << std::setprecision(Kommastellen) << std::fixed << Number[2] << " Cent | ";
Number[1] = 125,4
Number[2] = 12
Now the output is: 125,40 Euro | 12,00 Cent
But i need this output: 125,40 Euro | 12 Cent
How can i reset the setprescision?
Thanks, Christian
Check the value of Kommastellen.
Regards Mats
const std::streamsize old = stream.precision(); // save currentstream << std::setprecision(2) << std::fixed << Number[1] << " Euro | " << std::setprecision(0) << std::fixed << Number[2] << " Cent | ";stream.precision(old); // restore
Regards Mats
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement