(Geometry: intersecting point) Two points on line 1 are given as (x1, y1) and (x2, y2) and on line…
(Geometry: intersecting point) Two points on line 1 are given as (x1, y1) and (x2, y2) and on line 2 as (x3, y3) and (x4, y4), as shown in Figure 3.8a–b. The intersecting point of the two lines can be found by solving the following linear equation:
This linear equation can be solved using Cramer’s rule (see Programming Exercise 3.3). If the equation has no solutions, the two lines are parallel (Figure 3.8c).
Write a program that prompts the user to enter four points and displays the intersecting point. Here are sample runs:
Exercise 3.3
(Algebra: solve 2 2 linear equations) A linear equation can be solved using Cramer’s rule given in Programming Exercise 1.13. Write a program that prompts the user to enter a, b, c, d, e, and f and displays the result. If ad – bc is 0, report that “The equation has no solution.”
Exercise 1.13
(Algebra: solve 2 2 linear equations) You can use Cramer’s rule to solve the following 2
2 system of linear equation: