For this assignment the functions you are to write are as follows: double radian
ID: 3678707 • Letter: F
Question
For this assignment the functions you are to write are as follows: double radians(double degrees); double xCosXySinY(double x, double y); int linspace(double data[], double dataMin, double delta, int nPoints); Fills data[] with nPoints values, starting at dataMin and increasing in steps of delta. Returns the number of array spots filled, (normally nPoints), or -1 in the case of errors (bad input.) int linspace(double data[], double dataMin, double delta, double dataMax); Fills data[] with values, ranging from dataMin to dataMax in steps of delta, Returns the number of array spots filled, (calculated), or -1 in the case of errors (bad input.) double distanccAndVcctor(double x1, double y1, double x2, double y2, double & deltaX, double &deltaY;); Returns the distance between (x1, y1) and (x2, y2). Stores in (deltaX, deltaY) the vector pointing from (x1, y1) to (x2, y2). int xCosXySinY(int nRows, int nCols, double x[], double y[], double result[][ MAXCOLS]); Fills in result[][] by calling double xCosXySinY(double x, double y); The array passed to result must have MAXCOLS columns, nRows and nCols should be the number of rows and columns of result to fill. They should be checked for validity, x[] holds the X values to be used for each row. y[] holds the Y values to be used for each column.Explanation / Answer
1.double radian(double degrees)
{radian=(3.14/180)*degrees;
return radian;
}
2.
int linespace(double data[],double dataMin,double delta,int nPoints)
{int i=0
for(delta=dataMin;delta<nPoints;delta++)
{data[delta]=nPoints;
i++
} }
return i;
}
3.int linespace(double data[],double dataMin,double delta,double dataMax)
{int i=0;
for(delta=dataMin;delta<dataMax;delta++)
{ cin>>data[delta];
i++;
}
return i;
}
4.doubledistanceAndVector(double x1,double y1,double x2,double y2,double&deltaX,double&deltaY)
{int r;
r=sqrt(pow((y2-y1),2) + pow((x2-x1),2));
return r;
deltaX=x2-x1;
deltaY=y2-y1
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.