Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Integer rounding after subtracting floating-point type from C++ shaping
Integer rounding after subtracting floating-point type from C++ shaping
(int)(a-b); Convert a to floating-point type first, and then subtract, for example, (int)(5-2.3)=(int)2.7=2.

a-(int)b; B is converted into an integer and then subtracted, for example, 5-(int)2.3=5-2=3.