Ocena użytkownikóww: ***** / 2
Nadesłany przez Michał Knasiecki, 03 sierpnia 2005 01:00
Kod przedstawiony poniżej przedstawia główną część rozwiązania problemu.
Pobierz pełne rozwiązanie.Jeżeli nie odpowiada Ci sposób formatowania kodu przez autora skorzystaj z pretty printer'a i dostosuj go automatycznie do siebie.
Odcinek_d/Unit1.pas:
//Program został pobrany ze strony www.algorytm.org
//Opracował Michał Knasiecki
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,math;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
Label5: TLabel;
Edit3: TEdit;
Label6: TLabel;
Edit4: TEdit;
Label7: TLabel;
Label8: TLabel;
Edit5: TEdit;
Label9: TLabel;
Edit6: TEdit;
Label10: TLabel;
Label11: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type wsp=record //współrzędne
x,y:byte;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,c:wsp; //punkty
det:integer;//wyznacznik macierzy
begin
//Pobieranie współrzędnych
a.x:=strtoint(edit1.text);
a.y:=strtoint(edit2.text);
b.x:=strtoint(edit3.text);
b.y:=strtoint(edit4.text);
c.x:=strtoint(edit5.text);
c.y:=strtoint(edit6.text);
//Sprawdzanie współliniowości punktów:
det:=a.x*b.y+b.x*c.y+c.x*a.y-c.x*b.y-a.x*c.y-b.x*a.y;
if det<>0 then showmessage('Punkt C NIE należy do odcinka |AB|- punkty nie są współliniowe') else
begin
if (min(a.x,b.x)<=c.x)and(c.x<=max(a.x,b.x)) and (min(a.y,b.y)<=c.y)and(c.y<=max(a.y,b.y)) then
showmessage('Punkt C należy do odcinka |AB|') else
showmessage('Punkt C NIE należy do odcinka |AB|');
end;
end;
end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,math;
mógłby mi ktoś pilnie pomóc? licze na wsparcie! pozdrawiam i czekam :)