Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions