Answered step by step
Verified Expert Solution
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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started