Simple way to see 0.12345 in this case is to use the type double, but it may be useful to understand what happens:
12345.12345 is not a value that can be stored in a variable of type float. It lies between the two valid floats: 12345.123046875 and 12345.1240234375. Since it's closer to the first one, that's what cin >> f actually stores.
After subtracting 12345, you end up with 0.123046875, and since cout <<'s default precision is 6, you're seeing the output of 0.123047
what do you mean by
It lies between the two valid floats: 12345.123046875 and 12345.1240234375
Compare to int: the value 12345 is a value that can be stored in an int, the value 12346 is the next value that can be stored in an int. If you attempt to store 12345.2 in an int, it will be rounded and 12345 will be stored.
Same thing happens here, only with floats: you're trying to store 12345.12345, so it's rounded to 12345.123046875