If you are puzzled about the dots here is what they are:
%.1lf
is the format specification for precision. This is requesting one digit after the decimal point in theprintf
output.- The
1.
and2.
in(a*1.+b)/2.
mean that those literals aredouble
(as opposed to1
that would beint
and1.f
that would befloat
). Whoever wrote that snippet was probably trying to avoid truncation in computing that average (givena
andb
areint
).
solved Dots in printf in C++