C++ arrays in function


Write a function named "sum" that takes as its arguments the following:
(1) an array of floating point values.
(2) an integer that tells how many floating point values are in the array.
The function should return as its value the sum of the floating point values. For example, if the array that's passed to the function looks like this:
0 1 2 3 4
5.8|2.6|9.0|3.4|7.1
The function should return the value as 27.9 as its value

I don't even know how to start this. I know I need to declare and intialize the array in the main function. I don't how to write the sum function. Thank you.
Last edited on
And what part of that are you having problems with?
It is not a question on programming. It is a question on arithmetic. Do not you know how numbers are added? Try to write the sum of doubles on a paper.:)
Topic archived. No new replies allowed.