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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, ghazanfarwaheed7967
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
image
Computers and Technology, 22.06.2019 13:50, juan3937
The instruction ishl (shift left integer) exists in jvm but not in ijvm. it uses the top two values on the stack, replacing the two with a single value, the result. the sec- ond-from-top word of the stack is the operand to be shifted. its content is shifted left by a value between 0 and 31, inclusive, depending on the value of the 5 least signifi- cant bits of the top word on the stack (the other 27 bits of the top word are ignored). zeros are shifted in from the right for as many bits as the shift count. the opcode for ishl is 120 (0x78).a. what is the arithmetic operation equivalent to shifting left with a count of 2? b. extend the microcode to include this instruction as a part of ijv.
Answers: 1
image
Computers and Technology, 23.06.2019 05:00, sharkboy578
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
image
Computers and Technology, 23.06.2019 11:20, 1tzM3
Http is the protocol that governs communications between web servers and web clients (i. e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
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 in other subjects:

Konu
English, 06.11.2020 23:10
Konu
Spanish, 06.11.2020 23:10
Konu
Mathematics, 06.11.2020 23:10