+ 1
( sorry I forgot to make it public) How do I stop the execution of the program? In the program given below
this is a program to convert number with base 10 after the decimal part (0.xyz) to base 8. the program runs well but it doesn't stop when I input the value 0.53125 the output i want it 0.42 but the output i get is 0.420202 what changes should I make? link of the program http://www.sololearn.com/app/cplusplus/playground/c5l1398xrTor/
1 Réponse
0
I am unable get to the link. But you can put these lines before displaying the value.Make sure you have put "iomanip" header file.
cout.setf(ios::fixed);
cout.precision(2);
It sets your decimal part to a precision of 2.
I hope it works.😃