Question: using C++ please Given two points (x1, y1) and (x2, y2), the slope of the line running through those points is defined as rise /

using C++ please

Given two points (x1, y1) and (x2, y2), the slope of the line running through those points is defined as rise / run, or

(y2-y1) / (x2-x1) 

Recall that the slope is defined as rise / run, or (y2-y1) / (x2-x1). In the previous exercise you were allowed to assume that the run would never be 0, thus avoiding division by 0. This assumption is no longer true.

Since division by 0 is mathematically undefined, your task in this assignment is to check for a run == 0.0, and output Slope: undefined in this case. Example: given the inputs

1 3 1 -3 

Your program should now output

(1,3) (1,-3) Slope: undefined 

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!