Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Floating-point plus shaping
Floating-point plus shaping
Divisible, the computer will automatically convert the type of integer variable to floating-point type (but the data type and value of the integer variable itself will not change), and then perform floating-point operation.

Examples are as follows:

int? a 1=4,? a2;

Floating? b 1? =? 5.2,? B2;

a2? =? b 1/a 1; //? The result of the operation is 1. Because a2 is of type int, the result of 5.2/4= 1.3 is converted to type int, that is, the fractional part is discarded.

b2? =? b 1/a 1; //? The result of the operation is 1.3, because b2 is a floating-point type and can represent decimals, so the result of 5.2/4= 1.3 is directly assigned to the variable b2.