You have a struct defined as struct Coordinate { int x; int y;}; And you have va
ID: 3698187 • Letter: Y
Question
You have a struct defined as struct Coordinate { int x; int y;}; And you have variables defined from it: Coordinate point1; Coordinate point2: Show just the code needed to access the y value of point2. The formula to find the distance between two points is: Distance Formula: Given the two points (x_1, y_1) and (x_2, y_2), the distance between these points is given by the formula: d = squareroot (x_2 - x_1)^2 + (y_2 - y_1)^2 Using the struct definition in the previous questions, show the code needed to find the distance between point1 and point2, using cmath functions as needed. Show just the line of code to produce the distance - do not show any include statements or an entire program.Explanation / Answer
Answer 1:
You can write it as point2.y
Answer2:
d=sqrt((pow(point2.x - point1.x),2) + (pow(point2.y - point1.y),2))
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.