Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

2 сем_1 / 8 лаба / Unit3

.pas
Скачиваний:
5
Добавлен:
18.07.2019
Размер:
1.77 Кб
Скачать
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.
Соседние файлы в папке 8 лаба
  • #
    18.07.2019188 б5Project1.dpr
  • #
    18.07.2019876 б5Project1.res
  • #
    18.07.20195.97 Кб5Unit3.dcu
  • #
    18.07.201951 б5Unit3.ddp
  • #
    18.07.2019904 б5Unit3.dfm
  • #
    18.07.20191.77 Кб5Unit3.pas
  • #
    18.07.2019242.61 Кб7Лаба 8.docx