Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Math, VclTee.TeeGDIPlus,
- VCLTee.TeEngine, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, VCLTee.Series;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Min: TEdit;
- Max: TEdit;
- Step: TEdit;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Memo1: TMemo;
- Chart1: TChart;
- Label7: TLabel;
- Series1: TFastLineSeries;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var a,b,y,h:double;
- f:TextFile;
- begin
- Memo1.Clear;
- chart1.View3D := false;
- if not trystrtofloat(stringreplace(Min.text,'.',',',[]),a) then
- begin
- showmessage('Неверное мин знач');
- Exit;
- end;
- if not trystrtofloat(stringreplace(Max.text,'.',',',[]),b) then
- begin
- showmessage('Неверное макс знач');
- Exit;
- end;
- if not trystrtofloat(stringreplace(Step.text,'.',',',[]),h) then
- begin
- showmessage('Неверный шаг');
- Exit;
- end;
- if h<=0 then
- begin
- showmessage('Неверный шаг');
- Exit;
- end;
- if a>b then
- begin
- showmessage('Макс. значение меньше мин.');
- Exit;
- end;
- AssignFile(f, 'OUTPUT.txt');
- Rewrite(f);
- Memo1.lines.add('x y');
- chart1.ClearChart();
- chart1.AddSeries(TFastLineSeries);
- chart1.series[0].Color := clBlack;
- while a<=b do
- begin
- if a>=0 then
- begin
- y:=SimpleRoundTo(Power(a,6.5)/exp(Cos(a)),-3);
- Memo1.lines.add(FloatToStr(a)+' '+FloatToStr(y));
- writeln(f,floattostr(a)+' '+floattostr(y));
- chart1.series[0].AddXY(a,y);
- end
- else
- begin
- chart1.View3D := false;
- Memo1.lines.add(floattostr(a)+' -');
- writeln(f,floattostr(a)+' -');
- end;
- a:=SimpleRoundTo((a+h),-3);
- end;
- closefile(f);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement