Question: a) (10 points] Write the main program to do followings. By using the C++ Standard Template Library (STL) vector, define a vector variable named

a) (10 points] Write the main program to do followings. By using

a) (10 points] Write the main program to do followings. By using the C++ Standard Template Library (STL) vector, define a vector variable named Vct. Template parameter type of the vector is int. Ask user to enter the number of elements in vector. By looping, ask user to enter integer numbers and add them to Vct vector. (Use built-in vector function push_back(...) Call the function GeometricMean() with necessary parameter, and display the returned result. b) [10 points] Write the C function named GeometricMean(). Function takes a vector named V as function parameter. The vector template parameter type is int. By looping (use built-in vector function size() ), function should calculate the geometric mean of integer values in vector V. (Geometric mean = Nth root of the multiplication of N numbers = "/X,.X2. X3 ... N ) Function should return the result as float. Example Screen Output: Enter number of elements in vector 3. Enter an integer Enter an integer Enter an integer : 5 : 2 : 8 Geometric mean of numbers : 4.308869

Step by Step Solution

3.31 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER FOR QUESTION A include include include using namespace std ... View full answer

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!