Hi I need to be able to output two columns into a file. One is for hour and one is for total energy used during that hour interval. The problem I am having is I don't know how to store the total energy per hour. This is what I have done so far and not sure where it is I am going wrong. Can someone give me some guidance please.
while(hours.at(index) < (hours.at(index) + 1) || index != 24)
I believe you made a typo here as one of the conditions shall always be true.
Are you finished writing the function (as far as what it basically does)? You inserted values into hourly but hourly is never used. kwConversion also looks unused. kwConversion's value is never changed. Each push back to hourly will involve division by 0 (or a really, really, really small magnitude).
Remember to increment your index, otherwise index will forever be 0.
-Passing references to mutable objects suggests that you're going to modify them in some way. However, the function you wrote treats the parameters as constant. Therefore, I suggest you write this:
const vector<double>& hours, //etc.
-Since you are using vectors, I strongly recommend you take advantage of its ability to tell you its size.