C Write Function Called Average Returns Int Takes Array Ints Int Size Array Function Must Q37166164

In C++, write a function called average that returns an int andtakes in an array of ints and the int size of the array. Thisfunction must return the average of all elements of the array.

After doing that, modify your answer to averagefloating-point numbers too. (TIP: useoverloading to reduce the amount of code you must write).

Do not do both at the same time, do them separately. You shouldhave two different answers for both parts of this question.


Answer


small color{blue}underline{1:}

#include <iostream>using namespace std;double average(int *arr, int size) { double total = 0;

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.