Guys, I only get integer values. I really can’t get double values.
The question is below, please help.
Normalization is the process of returning data to its normal condition. In this task you will
implement a simple normalization which calculates the mean of an array and then subtracts
that mean from each element in the array.
Create two functions double normalize(int array[], int size) and double normalize (double array[],
double size) that takes in an array of numbers (int, or double). The function should firstly
calculate the mean of all values in the array. Secondly, the mean should be subtracted from
each element in the array, and finally, the function should return the mean. Note that arrays
are passed by reference in C++, meaning that if you pass an array to the function, you
can change the values of the array inside the function. The array of the calling scope will
afterwards contain the updated elements.
In order to keep things simple the arrays will always have a fixed size of 5. First the user
should be asked which data type the array should be (i for integer, d for double). The subsequent operations should then be done on this array type. After that, the user should
input each of the five values for the array. Then the array should be normalized with the
implemented function and the returned mean should be printed to screen. Finally, each
element in the array should be printed on a separate line. Note that the values will be
different from the user input, since the mean was subtracted from the elements. You may
assume that the mean is always a double.