+ 2

How to print 2 decimal places?

How to print 2 decimal places? E.g: 2.45 -> print 45 Sorry! I'm not so good at English.

2nd Oct 2017, 7:32 PM
Gin
Gin - avatar
2 Antworten
+ 3
Thank you very much!
2nd Oct 2017, 7:54 PM
Gin
Gin - avatar
+ 11
#include <iostream> #include <iomanip> using namespace std; int main() { double dbl = 3.1415926; cout << fixed << setprecision(2) << dbl; return 0; }
2nd Oct 2017, 7:36 PM
ChaoticDawg
ChaoticDawg - avatar