I would like this program to calculate the sum of all elements in the energy vector. When I try to compile, I get a list of about 50 errors relating to the numeric header file. Can somebody tell me whats wrong with my code please.
std::accumulate synthesizes its return type from the third parameter. The literal value "0" is an int, however you are summing floats. You need to tell the compiler that "0" means "float". To do that, use "0.0f" instead.
float sum = std::accumulate( energy.begin(), energy.end(), 0.0f );