Thank you in advance. I just need help doing the 2 cord equation. 1 cord works like a charm
SCAR Code:
procedure slope;
var
q,slopes,x1,y1,x2,y2,xs,ys,b2s,m1s,slopes,alls : integer;
b2,m1,slopess,all:extended;
begin
q := strtoint(readln('Type 1 or 2 for the following:(1: 1 cord, 2: 2 cord)'));
if q = 1 then
begin
slopes := strtoint(readln('What is the slope of the line?'));
x1 := strtoint(readln('What is the x cord?'));
y1 := strtoint(readln('What is the y cord?'));
m1 := slopes * x1;
if m1 < 0 then
begin
q := 999;
b2 := y1 + m1;
end;
if m1 > 0 then
begin
q := 99;
b2 := y1 - m1;
end;
if (q = 999) then
begin
writeln('The equation: y = '+inttostr(slopes)+'x '+floattostr(b2));
end;
if (q = 99) then
begin
writeln('The equation: y = '+inttostr(slopes)+'x '+floattostr(b2));
end;
end;
if q = 2 then
begin
x1 := strtoint(readln('What is the first x cord?'));
y1 := strtoint(readln('What is the first y cord?'));
x2 := strtoint(readln('What is the second x cord?'));
y2 := strtoint(readln('What is the second y cord?'));
ys := y1 - y2;
xs := x1 - x2;
all := ys / xs;
slopess := all;
m1 := all * x1;
alls := ys / xs;
slopes := alls;
m1s := alls * x1;
if m1 < 0 then
begin
q := 999;
b2 := y1 + m1;
end;
if m1 > 0 then
begin
q := 99;
b2 := y1 - m1;
end;
if (q = 999) then
begin
writeln('The equation: y = '+floattostr(slopess)+'x '+floattostr(b2));
end;
if (q = 99) then
begin
writeln('The equation: y = '+floattostr(slopess)+'x '+floattostr(b2));
end;
// This part is incase number is a whole number?
if m1s < 0 then
begin
q := 999;
b2s := y1 + m1s;
end;
if m1s > 0 then
begin
q := 99;
b2s := y1 - m1s;
end;
if (q = 999) then
begin
writeln('The equation: y = '+inttostr(slopes)+'x '+inttostr(b2s));
end;
if (q = 99) then
begin
writeln('The equation: y = '+inttostr(slopes)+'x '+inttostr(b2s));
end;
end;
end;