Witam chcę zrobić wykres funkcji którego wykresem jest hiperbola , chciałbym żeby zawierała się tylko w dodatniej części układu współrzędnych (tzn tylko w górnej prawej części układu ) . W programie musze podac parametr a . Zrobiłem program lecz jest błąd w jednej linijce i program nie chce zadziałać a ja nie wiem o co chodzi (jestem początkujący w delphi). Proszę o pomoc.
o to kod (1 button , 1 edit , 1 iamge)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a, i, x, y : real;
begin
a := StrToint(Edit1.Text);
With Image1 do
begin
Canvas.MoveTo(100, 0);
Canvas.LineTo(100, 200);
Canvas.MoveTo(0, 100);
Canvas.LineTo(200, 100);
end;
//Rysowanie wykresu funkcji
Image1.Canvas.MoveTo(-1, 101);
x := 0;
REPEAT
begin
y := a/x;
Image1.Canvas.LineTo(x + 100, -y + 100);
x := x + 1;
end;
UNTIL (x = 100);
end;
end.
tu mam błąd :
Image1.Canvas.LineTo(x + 100, -y + 100);