CodeClerks

Setting Precision With precision() Function



Write the reason you're deleting this FAQ

Setting Precision With precision() Function

By default, the floating numbers are printed with six digits after the decimal point. However, we can specify the number of digits to be displayed after the decimal point while printing the floating point numbers. This can be done by using the precision() member function as follows:



cout.precision();


Whereis the number of digits to the right of the decimal point. For example, the
statements:

cout.precision(3);

cout

Comments

Please login or sign up to leave a comment

Join