Question: C++ Exercise #3: SubTotal Write a function named subtotal takes as its arguments the following: a one dimensional array of floating point values; an integer
C++ Exercise #3: SubTotal Write a function named "subtotal" takes as its arguments the following: a one dimensional array of floating point values; an integer that tells the number of cells in the array. The function should replace the contents of each cell with the sum of the contents of all the cells in the original array from the left end to the cell in question. Thus, for example, if the array passed to the function looks like this: 2 5.81 2.6 19.1 13.41 7.0 Then when the function returns, the array will have been changed so that it looks like this: 2 5.818.4117.5 1 20.9 1 27.9 Note that the contents of cell 0 are not changed. The function should not return a value. Write a main program that tests and validates the subtotal function. Sample input/output: lease enter the number of values in the array: 5 lease enter the values for your array: 1 2 3 45 6 .1e 15
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
