Problem

(Geometry: same line?) Programming Exercise gives a function for testing whether three poi...

(Geometry: same line?) Programming Exercise gives a function for testing whether three points are on the same line. Write the following function to test whether all the points in points array are on the same line.

const int SIZE =2; bool sameLine(const double points[][SIZE],int numberOfPoints)

Write a program that prompts the user to enter five points and displays whether they are on the same line. Here are sample runs:

(Geometry: point position) Programming Exercise shows how to test whether

a point is on the left side of a directed line, right, or on the same line. Write the following functions:

/** Return true if point (x2, y2) is on the left side of*        directed line from (x0, y0) to (x1, y1) */ bool leftOfTheLine(double x0, double y0,double x1, double y1, double x2, double y2)/** Return true if point (x2, y2) is on the same*        line from (x0, y0) to (x1, y1) */ bool onTheSameLine(double x0, double y0,double x1, double y1, double x2, double y2)/** Return true if point (x2, y2) is on the*        line segment from (x0, y0) to (x1, y1) */ bool onTheLineSegment(double x0, double y0,double x1, double y1, double x2, double y2)

Write a program that prompts the user to enter the three point s for p0, p1, and p2 and displays whether p2 is on the left of the line from p0 to p1, right, the same line, or on the line segment. Here are some sample runs:

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT