Question: C++ help Please. Complete this function that calculates the N-powers of the numbers in an array numbers and put the results in the same numbers
C++ help Please.
Complete this function that calculates the N-powers of the numbers in an array "numbers" and put the results in the same numbers array. N is given as the exponent parameter. Function returns the sum of all the results. Assume that "cmath" is already included. Use only one loop in the function
In main()
This is given to you as a sample, do not write it:
double arr [5] = { 1.2, 3.4 , 5.6, 12.8, 1.7 };
double result = getPowers(arr, 3, 5); // result contains the sum of the result
array
// arr array will contain the cubic powers (power 3) of the numbers
Function definition:
double getPowers(double numbers[ ], int exponent, int size) {
//.
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
