+ 1
std::setprecision std::cout.precision
What is the difference is usage between std::cout.precision and std::setprecision? (except for setprecision <iomanip> is needed) It gives pretty same result I can't figure the difference
3 Antworten
+ 4
There is no difference. std::setprecision(n) behaves the same as std::cout.precision(n). The only difference is that std::setprecision(n) is a stream manipulator, used like so
std::cout << std::setprecision(3) << ...;
(std::cout can be replaced by any derivative of std::ios_base)
while std::cout.precision is a method
0
🇺🇦 Vitya 🇺🇦 I believe you could help🙏
0
XXX thanks a lot