This C++ program defines a structure called "pt" to store the x, y, and z coordinates of 3D points. It prompts the user to input the coordinates of points P1 and P2, stores them in variables, calculates the sum of the corresponding x, y, and z values to determine the coordinates of point P3, and prints out the results.
This C++ program defines a structure called "pt" to store the x, y, and z coordinates of 3D points. It prompts the user to input the coordinates of points P1 and P2, stores them in variables, calculates the sum of the corresponding x, y, and z values to determine the coordinates of point P3, and prints out the results.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
This C++ program defines a structure called "pt" to store the x, y, and z coordinates of 3D points. It prompts the user to input the coordinates of points P1 and P2, stores them in variables, calculates the sum of the corresponding x, y, and z values to determine the coordinates of point P3, and prints out the results.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
struct pt { int x,y,z; }; void main() { struct pt P1,P2,P3; cout<<"enter the coordinates of point P1 and P2"; cin>>P1.x>>P1.y>>P1.z>>P2.x>>P2.y>>P2.z; P3.x=P1.x+P2.x; P3.y=P1.y+P2.y; P3.z=P1.z+P2.z; cout<<"the coordinates of point P3 is"<<P3.x<<P3.y<<P3.z;