Question: // This program demonstrates the vector's empty member function. #include #include using namespace std; // Function prototype double avgVector(vector ); int main() { __________________ //

// This program demonstrates the vector's empty member function.

#include

#include

using namespace std;

// Function prototype

double avgVector(vector);

int main()

{

__________________ // A vector to hold values

int numValues; // The number of values

double average; // To hold the average

// Get the number of values to averge.

cout << "How many values do you wish to average? ";

cin >> numValues;

// Get the values and store them in the vector.

for (int count = 0; count < numValues; count++)

{

____________________; //fill in the blank

____________________;

____________________;

____________________;

}

// Get the average of the values and display it.

average = avgVector(values);

cout << "Average: " << average << endl;

return 0;

}

//*************************************************************

// Definition of function avgVector. *

// This function accepts an int vector as its argument. If *

// the vector contains values, the function returns the *

// average of those values. Otherwise, an error message is *

// displayed and the function returns 0.0. *

//*************************************************************

double avgVector(vector vect)

{

int total = 0; // accumulator

double avg; // average

if (__________________) // Determine if the vector is empty

{

________________________;

________________________;

}

else

{

__________________________;

____________________________;

____________________________;

}

return avg;

}

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 Databases Questions!