subject

Given n points P1(x1, y1, z1), P2(x2, y2, z2) . . . Pn(xn, yn, zn), implement the function centerPoint() that finds the center point using the following formula: C(xc, yc, zc)=(x1 +x2 +...+xn, y1 +y2 +...+yn, z1 +z2 +...+zn)
nnn
centerPoint() takes three arguments: a pointer to an array of struct point*, the number of points in the array, and a pointer to struct point center. It then calculates the coordinates of the center point (for all the points in the array) and stores it in struct point center. You may not use any square brackets ([]) in centerPoint().
struct point { float x;
float y;
float z; };
void centerPoint(struct point** points, int n, struct point* center) {
}
int main(void) {
struct point center;
struct point* points[100];
setPoints(points, 100);//Dynamically allocates the points
//and initializes the points
centerPoint(points, 100, &center);
printf("center point is (%f, %f, %f)\n, center. x, center. y, center. z); return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x,y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
You know the right answer?
Given n points P1(x1, y1, z1), P2(x2, y2, z2) . . . Pn(xn, yn, zn), implement the function centerPoi...
Questions