
- •1. Создание консольного приложения в среде Delphi
- •Var х,у,z:real;
- •Save changes to Unitl.Pas? (Сохранить изменения в Unitl.Pas?),
- •1. Из таблицы 3.1 взять условие задачи (вариант согласовать с преподавателем). Таблица 3.1
- •Var a1 :textfile; // a1 – текстовый файл
- •При открытии файла желательно использовать функцию
- •InitialDir типа String – определяет каталог, содержимое которого отображается при вызове окна диалога. Если каталог не задан, то отображается содержимое текущего каталога;
- •С войства компонентов
- •Контрольные вопросы
С войства компонентов
object Form1: TForm1
Left = 252
Top = 107
Width = 458
Height = 397
Caption = 'Лабораторная работа'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 32
Top = 8
Width = 30
Height = 13
Caption = 'X нач.'
object Label2: TLabel
Left = 184
Top = 8
Width = 31
Height = 13
Caption = 'Х кон.'
object Label3: TLabel
Left = 320
Top = 8
Width = 29
Height = 13
Caption = 'шаг Х'
object Xn_Edit: TEdit
Left = 88
Top = 8
Width = 57
Height = 21
TabOrder = 0
Text = '0'
object Xk_Edit: TEdit
Left = 224
Top = 8
Width = 57
Height = 21
TabOrder = 1
Text = '1'
object dX_Edit: TEdit
Left = 360
Top = 8
Width = 57
Height = 21
TabOrder = 2
Text = '0,1'
object Chart1: TChart
Left = 16
Top = 40
Width = 425
Height = 273
AllowPanning = pmNone
BackWall.Brush.Color = clWhite
BackWall.Brush.Style = bsClear
PrintProportional = False
Title.Text.Strings ='Y = sin (X)'
BottomAxis.Increment = 0.1
View3D = False
View3DWalls = False
TabOrder = 3
object Series1: TLineSeries
Marks.ArrowLength = 8
Marks.Visible = False
SeriesColor = clRed
ShowInLegend = False
Dark3D = False
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.DateTime = False
XValues.Name = 'X'
XValues.Multiplier = 1
XValues.Order = loAscending
YValues.DateTime = False
YValues.Name = 'Y'
YValues.Multiplier = 1
YValues.Order = loNone
object Button1: TButton
Left = 16
Top = 328
Width = 113
Height = 33
Caption = 'График'
TabOrder = 4
OnClick = Button1Click
object Button2: TButton
Left = 184
Top = 328
Width = 105
Height = 33
Caption = 'Печать'
TabOrder = 5
OnClick = Button2Click object Button3: TButton
Left = 328
Top = 328
Width = 97
Height = 33
Caption = 'Выход'
TabOrder = 6
OnClick = Button3Click
Программа
unit Lab2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart, Math, Printers;
type
TForm1 = class(TForm)
Label1: TLabel;
Xn_Edit: TEdit;
Label2: TLabel;
Xk_Edit: TEdit;
Label3: TLabel;
dX_Edit: TEdit;
Chart1: TChart;
Series1: TLineSeries;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var xn,xk,dx,x,y:real;
begin
xn:=StrToFloat(Xn_Edit.Text);
xk:=StrToFloat(Xk_Edit.Text);
dx:=StrToFloat(dX_Edit.Text);
Chart1.BottomAxis.Increment:=(Xk-Xn)/10;
x:=xn;
while x<=xk do
begin
y:=1/Sin(x);
Series1.AddXY(x,y);
x:=x+dx;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Chart1.Print;
end;
end.