Question: 10.(20 points) Write a function that, given two points of a line (x1, y1)-(x2, y2) will calculated the slope (m) and y-intercept (b). The function

 10.(20 points) Write a function that, given two points of a

10.(20 points) Write a function that, given two points of a line (x1, y1)-(x2, y2) will calculated the slope (m) and y-intercept (b). The function MUST have the following prototype: int get_mb (double xi, double yl, double x2, double y2, double* m, double* b); The inputs to the function are x1, yl, X2, y2. The variables m and b should be set by the function The slope (m) is calculated by (y2-y1)/(x2-X1) Once the slope is calculated, the y-intercept (b) may be calculated by The function should normally return a value of 0 UNLESS the line given is a vertical line ich case the slope is infinity). If the slope is infinity, then m and b should be set to 0, and a -1 should be returned. The function shall not contain any printf) or scanf0 statements. Doing so results in a score of zero for the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!