Question

C++ ( Please Read) Write a function prototype and a function definition called getTotal that receives...

C++ ( Please Read)

Write a function prototype and a function definition called getTotal that receives an  array of type double, the number of rows in the array.

It returns the total of all elements in the array.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
// function prototype
double getTotal(double arr[], int size);

// function definition
double getTotal(double arr[], int size) {
    double sum = 0;
    for (int i = 0; i < size; ++i) {
        sum += arr[i];
    }
    return sum;
}
Add a comment
Know the answer?
Add Answer to:
C++ ( Please Read) Write a function prototype and a function definition called getTotal that receives...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT