+ 1

How can we print some specific number after point in floating number ? I want output 3.00

float a; cin>>a; cout<<a; input : 3 output : 3.000000 in c we have used printf("%.2f",a); Here what we need to do?

20th Jan 2018, 10:24 AM
SUBHAJIT MAHATA
SUBHAJIT MAHATA - avatar
1 Réponse
+ 3
I C++ you can use the function std::setprecision from the <iomanip> library: http://www.cplusplus.com/reference/iomanip/setprecision/
20th Jan 2018, 10:45 AM
Shadow
Shadow - avatar