Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Why is it forced to convert decimals into integers in C++
Why is it forced to convert decimals into integers in C++
It is not forced conversion, but cout is not set. The 0 after 1.0 will be omitted. If the output of 1.7 is calculated, it will definitely not be converted into int.

To output 1.0, you need to set the precision of cout.

cout . precision(6); ?

cout . setf(IOs::fixed); ? ///output? 6? Decimal? Will it exceed the original decimal places? Make up 0? (will be rounded)?

cout? & lt& lt? 1.200? & lt& lt? endl