+ 7
You need to use setprecision() on the cout object.
http://www.cplusplus.com/reference/iomanip/setprecision/
ex: std::setprecision(numberofdigits);
+ 7
-A detailed tutorial on data types
https://www.tutorialspoint.com/cplusplus/cpp_data_types.htm
+ 6
Calculations in double are more precise but to output the result with a given number of digits you need to precise it....
+ 6
Yes. You need to format the output.
+ 5
Each Data type in C++ such a number types int, double , float, long double, have ranges.
+ 5
double will not display extra zeros
eg 14.0 - float would display the zero though
+ 5
if you want a variable to have a certain amount of digits used the right data type for the job
+ 5
@Christos
if you give the value long (long doub) 12.0001
that number will be displayed
if you give 12.000
double will ignore the zeros and output 12
+ 3
Here is a example
https://code.sololearn.com/cBga5IERN57L/?ref=app
+ 3
My mistake that code takes the remainer of what is not covered in a data type.
max ranger if no value for a range