-11
. .
. .
: Delphi, , , ; .
, x, y, z , B . |
:
- | n1,n2,n3 | Byte | , |
- | Y1 | Real | , |
a,b,c | a,b,c | Real | |
x,y,z | x,y,z | Mas |
:
n | Byte | , |
i | Byte | , |
x | Mas | , |
:
n | Byte | , |
i | Byte | , |
x | Mas | , |
nom | Byte | , |
min | Real | |
i | Byte | , |
x | Mas | , |
:
minnn:
:
1) :
n1=4; n2=4; n3=4;
x:1 2 3 4
y:0 2 -1 2
z:3 5 6 8
a=1
b=-1
c=3
:
y1= 5,96807473987015
2) :
n1=4; n2=4; n3=4;
x:-1 -1 -1 -1
y:0 0 0 0
z:1 1 1 1
a=-1
b=0
c=1
:
y1=- 0,47558704557631
:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
StringGrid1: TStringGrid;
StringGrid2: TStringGrid;
StringGrid3: TStringGrid;
Button1: TButton;
StringGrid4: TStringGrid;
StringGrid5: TStringGrid;
StringGrid6: TStringGrid;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
|
|
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
type
mas=array[1..20] of real;
var
a,b,c:real;
x,y,z:mas;
n1,n2,n3:byte;
y1:real;
Procedure VVOD(var n:byte;var x:mas;Ed:TEdit;St:TStringGrid);
var
i:byte;
begin
n:=StrToInt(Ed.Text);
For i:=1 to n do
x[i]:=StrToFloat(St.Cells[i-1,0]);
end;
Procedure VIVOD(n:byte;x:mas;St:TStringGrid);
var
i:byte;
begin
For i:=1 to n do
St.Cells[i-1,0]:=FloatToStr(x[i]);
end;
function minnn (n:byte;x:mas):real;
var
i,nom:byte;
min:real;
begin
min:=x[1];
i:=1;
nom:=1;
While i<=n do
begin
if (min>x[i]) then
begin
min:=x[i];
nom:=i;
end;
i:=i+2;
end;
minnn:=min;
end;
begin
VVOD(n1,x,Edit1,StringGrid1);
VVOD(n2,y,Edit2,StringGrid2);
VVOD(n3,z,Edit3,StringGrid3);
VIVOD(n1,x,StringGrid4);
VIVOD(n2,y,StringGrid5);
VIVOD(n3,z,StringGrid6);
a:=minnn(n1,x);
b:=minnn(n2,y);
c:=minnn(n3,z);
y1:=(3*a)+(3*(sin(b+sqr(c))));
Memo2.Lines.Add('a= '+FloatToStr(a)+' b= '+FloatToStr(b)+' c= '+FloatToStr(c)+' ='+FloatToStr(y1));
end;
end.
:
1)
2)
: Delphi, , , ; .