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
#include <iostream>using namespace std;double average(int *arr, int size) { double total = 0;
OR
OR