Question: Function scale multiples its first argument (a real number) by 10 raised to the power indicated by its second argument (an integer). For example, the
Function scale multiples its first argument (a real number) by 10 raised to the power indicated by its second argument (an integer). For example, the function call scale (2.5, 2) double scale (double x, int n) Returns the value 250.0 (2.5 X 10%). The function call double scale factor; scale factor - pow (10, n); scale (2.5, -2) return x*scale_factor; > Return the value 0.025 (2.5 x 102) Write only the main function, create and initialize a double array and then call the function scale for each elements of the array. At the end, the contents of the array must consist of scaled values. Create and use a separate integer array as the powers of each corresponding value. Eg. If double array has the following contents: 1.0 2.0 3.0 4.0 and the Integer array of powers have the following: 4 3 2 2 After function calls, the new contents of the double array must be updated as in seen in the following: 1.0x104 2.0x10 3.0x10 4.0x102
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
