Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

Students also viewed these Databases questions