Question: #include #include using namespace std; void bias (const int x[], int n); int main () { const int N=4; //change 4 to 20; double x[N],

 #include #include using namespace std; void bias (const int x[], int

#include

#include

using namespace std;

void bias (const int x[], int n);

int main ()

{

const int N=4; //change 4 to 20;

double x[N], y[N];

int k;

for (k=0; k

{

cout

cin>>x[k];

}

bias(x,y,n);

{

//Print out x&y arrays side by side;

for(k=0; k

{

cout

cin>>x[k];

}

for(k=0; k

{ cout

cin>>y[k];

}

}

system ("PAUSE");

return 0;

}

/*---------------------------------*/

void bias (double x[], int n)

{

double max_x, min_x;

int k;

double max (double x[], int n);

double min (double x[], int n);

max_x=max(x,n);

min_x=min(x,n);

for (k=0; k

{

x[k]=(x[k]-min_x)/(max_x-min_x);

}

}

int min(int x[], int n)

{

int k, temp;

temp=x[0];

for(k=1; k

{

if(temp>x[k])

temp=x[k];

}

return temp;

}

CSCI 40 ENGR 40 ASSIGNMENT ONE-DIMENSIONAL ARRAYS AS FUNCTION ARGUMENTS Write a function called bias that has three arguments: x-an input array of values, y - an empty output array of the same size as x, and n- an integer that specifies of elements in arrays x and y. The function bias should fill the y array with the x array values with the minimum value of the x ar example, if ray subtracted from each one. For 10 2 36 83 Thus the minimum value of the y array will always be zero. (This operation is referred to as removing the bias in array x). To get the minimum of the x array when needed in the bias function, call a function named min from within the function bias. (You will therefore need to write the function min as well, but we already did this in class). To test your functions write a driver main program that does the following 1. Establishes the size of arrays x and y at 20 2. Loads array x from the keyboard 3. Calls bias to fill the y array 4. Prints out the contents of arrays x and y side by side Turn in the source code for your main program and the functions bias and min Include output from two runs (one where the minimum value of the x array is positive and one where the minimum value is negative)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!