int sumTo(int value)
{
int total(0);
for (int count=1; count <= value; ++count)
total += count;
return total;
}
Where do I add cout<<total;
to print the results? I have tried to add the print function several locations without success -- either getting nothing or a large number (maybe a number previously stored in the location). Have debugger with the result showing total as 15 when value is equal to 5.
In addition, I have added a void function to print, but still no correct results.
Need help with the proper placement of the print function to yield the correct answer?