Question: Write a C++ program that accepts two ordered pairs (x2,y2) and (x1,y1) read from a file (points.dat). The file will contain an unknown number of
Write a C++ program that accepts two ordered pairs (x2,y2) and (x1,y1) read from a file (points.dat). The file will contain an unknown number of data records... process until end of file is encountered.
Your program will compute the slope, the distance between the two point and the midpoint.
Remember the slope may be undefined.
2 4 -3 9
5 6 -9 0
1 9 2 9
eof
sample input
OUTPUT
** REPORT **
Slope distance midpoint
0.45 78.99 (3, 2.5)
-9.0 94.00 (-3, -5.9)
UNDEF 10.90 (1.5, 9) Undefined Slope [X1 = 9 and X2 = 9]
Numbers on the file
4 5 -9 4 12 16 -6 -4 2.3 -1.3 5 -1.3 4 3 4 9 11 2 0 -8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
