### help fixing small error!

I'm supposed to find the equation of a line and the slope but I keep getting an error on line 17 that says
 error: expected ';' before '{'

 ``123456789101112131415161718192021222324`` ``````#include using namespace std; int main () { double x1, y1, x2, y2, m, b; cout << " Enter X1: " << endl; cin >> x1; cout << " Enter Y1: " << endl; cin >> y1; cout << " Enter X2: " << endl; cin >> x2; cout << " Enter Y2: " << endl; cin >> y2; if (x1 == x2) { cout << " The slope is undefined." << endl; } else m = (y2-y1)/(x2-x1) { cout << " The slope is: " << m << endl; b = y1-(m*x1) cout << " The y-intercept is: " << b << endl; } return 0; }``````
 ``12345678`` ``````else m = (y2-y1)/(x2-x1) { cout << " The slope is: " << m << endl; b = y1-(m*x1) cout << " The y-intercept is: " << b << endl; } return 0; }``````

should look like

 ``123456789`` ``````else { m = (y2-y1)/(x2-x1); cout << " The slope is: " << m << endl; b = y1-(m*x1); cout << " The y-intercept is: " << b << endl; } return 0; }``````

There was a semi colon missing at the end of line 19 as well.
 ``123456`` ``````else if ( m = (y2-y1)/(x2-x1) ) { cout << " The slope is: " << m << endl; b = y1-(m*x1); cout << " The y-intercept is: " << b << endl; }``````

Is this what you wanted?
missing semicolon
line 17 `else m = (y2-y1)/(x2-x1);`
line 19 `b = y1-(m*x1);`
Topic archived. No new replies allowed.