Home > Back-end >  Output floating point number
Output floating point number

Time:10-11

#include

using namespace std;

Int main ()
{
Double a;
cin> a;
cout
return 0;
}

If a is an integer integer part is how to guarantee the output?

CodePudding user response:

Integer output is an integer, floating point precision is higher than plastic

CodePudding user response:

Numerical output type conversion to plastic

CodePudding user response:

You run the first

CodePudding user response:

reference 1st floor qq_46221910 response:
integer output is an integer, floating point precision is higher than plastic
must be integer precision is higher than that of the floating point precision
By the way, the problem here and the precision has nothing to do

CodePudding user response:


If a is an integer to cout output must be an integer
If a is the decimal cou output is decimal
Here without considering precision, the accuracy is the inside of the program even if a=2, the output is 2, then a is still type double don't mixed up
  • Related