Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C++... Write a function normalize to normalize a sound Your function should t

ID: 3722945 • Letter: I

Question

In C++...

Write a function normalize to normalize a sound Your function should take two parameters: array samples of int type and the size of this array in this order It does not return anything it must be named normalize sound samples a rray is a two st Find the maximum (highest) value in the samples array Multiply all values in the samples array by 36773 and divide by the maximum value. Examples [0, 1, 2, 3] T0, 1*36773/3, 2*36773/3, 3*36773/3 3, 2,1,0] 13*36773/3, 2*36773/3, 1*36773/3, 0 5, 8,10] >15*36773/10, 8*36773/10,10*36773/10

Explanation / Answer

void normalize(int arr[], int n)
{
int maxx = 0;
for(int i=0; i<n; i++)
{
if(arr[i] > maxx)
maxx = arr[i];
}
for(int i=0; i<n; i++)
{
arr[i] = arr[i]*36773/maxx;
}
}