Port sum integers in file problem to C++.