Question: In C + + Code 5 . 6 1 . 1 : LAB: Calculate average Complete the CalcAverage ( ) function that has a double

In C++ Code
5.61.1: LAB: Calculate average
Complete the CalcAverage() function that has a double vector parameter and returns the average value of the elements in the vector as
an integer.
Ex: If the input vector is:
1.12.13.1quad4.15.1
then the returned average will be:
3
main.cpp
Hinclude
#include
using namespace std;
// CalcAverage() takes in a double vector and returns the average value of elements in the vector as an int.
int CalcAverage(vector nuns){
/* Type your code here. */
}
int main(){
vector nuns ={1.1,2.1,3.1,4.1,5.1};
cout CalcAverage(nuns) endl; // CaLcAverage() should return 3.
return 0;
}
In C + + Code 5 . 6 1 . 1 : LAB: Calculate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!