Update ex6_27.cpp

"sum" is more better name of the function, and the range for loop use "const auto&" more better.