+ 9

Problem in setting preision..

Why the precision goes wrongly?? https://code.sololearn.com/cS909f0REo1Y/?ref=app

3rd May 2019, 7:22 AM
Vivek Raj
Vivek Raj - avatar
7 odpowiedzi
+ 9
You are writing cout.precision(2); It is printing first 2 digits instead of it write cout.precision(4);. It will print 4 digits.
3rd May 2019, 7:47 AM
Yamin Mansuri
Yamin Mansuri - avatar
+ 7
~swim~ Thank you
3rd May 2019, 7:40 AM
Vivek Raj
Vivek Raj - avatar
+ 7
I want two digits after decimal point,,it works in computer but not in mobile,,I don't know why🙄🙄 Yamin Mansuri
3rd May 2019, 7:50 AM
Vivek Raj
Vivek Raj - avatar
3rd May 2019, 9:08 AM
Daljeet Singh
Daljeet Singh - avatar
+ 2
The precision take in consideration also the number before dot. In your case you should put precision(4) if you want 2 numbers after dot
3rd May 2019, 7:30 AM
raget88
raget88 - avatar