Question: Write a C + + program that use struct to represent 3 D point coordinate ( x , y , z . It asks user

Write a C++ program that use struct to represent 3D point coordinate (x,y,z. It asks user for two 3D point coordinates and output the midpoint of the two points.
a. In main(), get the input values from the user and store them in two struct variables for two 3D points P1(x1,y1,z1) and P2(x2,y2,z2)
b. Create a function to calculate the midpoint (x1+x22,y1+y22,z1+z22). This function takes two struct variables (3D points P1 and P2) as input parameters and returns a struct variable for midpoint.
c. In main(), call the user-defined function to get the midpoint and output the coordinate of the midpoint
Write a C + + program that use struct to

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 Programming Questions!