First
int score = 100; score = score * 1.05;
basically says:
int score = 100; score = (float)(score * 1.05);
This is because if you break a float with an integer, you get a float. It cannot be assigned to an integer.
but
int score = 100; score *= 1.05;
Basically means
int score = 100; score = (int)(score * 1.05);
This is because you are not assigning a float, the calculation is done, and the assignment is first converted to int.
Here's how it makes sense to me. Hope this helps.
Mitch dart
source share