Добавил:
Xer1t
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Math, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
lbl1: TLabel;
btn1: TButton;
mmo1: TMemo;
mmo2: TMemo;
lbl2: TLabel;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
type
Tx = array of Real;
implementation
{$R *.dfm}
procedure MINYSNAPLUS (m:array of Real ; var pol,nul,otr:Byte);
var k:Byte ;
begin
pol:=0;
otr:=0;
nul:=0;
for k:=0 to High(m)do
begin
if m[k]<>0 then
begin
if M[k]>0 then
Pol:=pol+1
else
otr:=otr+1;
end
else
nul:=nul+1;
end;
end;
procedure TForm1.btn1Click(Sender: TObject);
var x,y:array of Real; q,P,n,o,nx,n2,i:Byte; cod:Integer;
begin
nx:=mmo1.lines.count;
SetLength(x,nx);
for i:=0 to nx-1 do
begin
Val(mmo1.Lines[i],x[i],cod);
if cod<>0 then
begin
ShowMessage('данные не коректны');
Exit;
end;
x[i]:=StrToFloat(mmo1.Lines[i]);
MINYSNAPLUS (x,p,n,o);
end;
lbl1.caption:=lbl1.caption+#13+'Пол.='+Inttostr(p)+#9+'Нул.='+inttostr(n)+#9+'Отр.='+inttostr(o);
n2:=mmo1.lines.count;
SetLength(y,n2);
for q:=0 to n2-1 do
begin
Val(mmo2.Lines[q],y[q],cod);
if cod<>0 then
begin
ShowMessage('данные не коректны');
Exit;
end;
y[q]:=StrToFloat(mmo2.Lines[q]);
MINYSNAPLUS (y,p,n,o);
end;
lbl2.caption:=lbl2.caption+#13+'Пол.='+Inttostr(p)+#9+'Нул.='+inttostr(n)+#9+'Отр.='+inttostr(o);
SetLength(y,0);
SetLength(x,0);
end;
end.
interface
uses
Windows, Messages, SysUtils, Math, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
lbl1: TLabel;
btn1: TButton;
mmo1: TMemo;
mmo2: TMemo;
lbl2: TLabel;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
type
Tx = array of Real;
implementation
{$R *.dfm}
procedure MINYSNAPLUS (m:array of Real ; var pol,nul,otr:Byte);
var k:Byte ;
begin
pol:=0;
otr:=0;
nul:=0;
for k:=0 to High(m)do
begin
if m[k]<>0 then
begin
if M[k]>0 then
Pol:=pol+1
else
otr:=otr+1;
end
else
nul:=nul+1;
end;
end;
procedure TForm1.btn1Click(Sender: TObject);
var x,y:array of Real; q,P,n,o,nx,n2,i:Byte; cod:Integer;
begin
nx:=mmo1.lines.count;
SetLength(x,nx);
for i:=0 to nx-1 do
begin
Val(mmo1.Lines[i],x[i],cod);
if cod<>0 then
begin
ShowMessage('данные не коректны');
Exit;
end;
x[i]:=StrToFloat(mmo1.Lines[i]);
MINYSNAPLUS (x,p,n,o);
end;
lbl1.caption:=lbl1.caption+#13+'Пол.='+Inttostr(p)+#9+'Нул.='+inttostr(n)+#9+'Отр.='+inttostr(o);
n2:=mmo1.lines.count;
SetLength(y,n2);
for q:=0 to n2-1 do
begin
Val(mmo2.Lines[q],y[q],cod);
if cod<>0 then
begin
ShowMessage('данные не коректны');
Exit;
end;
y[q]:=StrToFloat(mmo2.Lines[q]);
MINYSNAPLUS (y,p,n,o);
end;
lbl2.caption:=lbl2.caption+#13+'Пол.='+Inttostr(p)+#9+'Нул.='+inttostr(n)+#9+'Отр.='+inttostr(o);
SetLength(y,0);
SetLength(x,0);
end;
end.