Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

ANSWER FOR QUESTION A include include include using namespace std ... 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

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions

Question

4 What is specific in constructivist approach to group coaching?

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago