So many problems beginners have which involve simple math calculations not coming out right in their C++ programs, seem to be attributable to this sort of "integer/double" mistake.
Ought to be the first thing checked.
(Fairness compels me to add that I'm still something of a beginner, myself. And I've fallen prey to this mistake a time or two.)