TViYH
2008-03-05 16:39:35
I need a script that finds distance from two points on a coordinate plane.
2008-03-05 16:39:35
2008-03-06 02:49:03
program New;
const
Ax = 0; Ay = 0;
Bx = 3; By = 4;
begin
WriteLn('Distance between the points is ' + IntToStr(Distance(Ax, Ay, Bx, By)));
end.
2008-03-06 09:33:09
2008-03-06 16:33:57
2008-03-07 03:54:12
From: Elkins121
Oh, thanks….Didn't know that existed…
EDIT: Now how to find slope plox.
program New;
const
ax = 0; ay = 0;
bx = 4; by = 4;
var
Slope: Extended;
begin
Slope := (ay - by)/(ax - bx);
Writeln('The gradient of the line connecting the two points is: ' + FloatToStr(Slope));
end.
2008-03-07 04:25:33
From: ZephyrsFury
program New;
const
ax = 0; ay = 0;
bx = 4; by = 4;
var
Slope: Extended;
begin
Slope := (ay - by)/(ax - bx);
Writeln('The gradient of the line connecting the two points is: ' + FloatToStr(Slope));
end.
The gradient of the line between two points is equal to the difference of the two y's divided by the difference of the two x's.
Hmm… it automatically rounds the decimal for some reason…
program New;
const
ax = 0; ay = 0;
bx = 4; by = 5;
var
Slope: Extended;
z, r : Extended;
begin
z := ay - by;
r := ax - bx;
Slope := z/r;
Writeln('The gradient of the line connecting the two points is: ' + FloatToStr(Slope));
end.
2008-03-07 07:48:47