Reference no: EM132167150
Using C++
Write a program that computes two measurements using only pointers to a structure and two functions to calculate:
(a) The distance between two points and
(b) The slope of the line passing through these two points.
Note:
1. The program should NOT to compute the slope of a vertical line.
2. The functions should return the appropriate values
3. The functions should receive a pointer to the structure.
4. Use the arrow operator to access the elements of the structure
• Fractional values need to be approximated by decimals.
• Recall that you should not declare a pointer without initializing it.
The output should look like the one of following:
The distance between (a, b) and (c, d) is # and the slope is #
The distance between (a, b) and (c, d) is # but there is no slope
Test your program with these sets of points:
(4, 7) and (8, 10), (4, -2) and (2, 2), (4, -2) and (3, -2), (5, 3) and (5, -2), (1/3, -3) and (2, -1/4)