#include using namespace std; int main(void) { double x1, y1; //first point double x2, y2; //second point double m; //slope (Dr. Milford) double b; //y-intercept //get two points cout << "Enter x1: "; cin >> x1; cout << "Enter y1: "; cin >> y1; cout << "Enter x2: "; cin >> x2; cout << "Enter y2: "; cin >> y2; //find the slope m = (y2-y1)/(x2-x1); //find the y intercept b=y1 - m*x1; //display the result if(b < 0) { //negative y-intercept cout << "Y=" << m << "x - " << -b << endl; } else { //positive y-intercept cout << "Y=" << m << "x + " << b << endl; } return 0; }