Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
10
Добавлен:
18.07.2019
Размер:
1.11 Кб
Скачать
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Sint;

type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
i: byte;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
pol: byte;
otr: byte;
n: byte;
x: array[1..100] of real;
BtnSt: Integer;
begin
pol:=0;
otr:=0;
n:= Memo1.Lines.Count;
BtnSt:=0;
for i:=1 to n do
begin
Val(Memo1.Lines[i-1],x[i],BtnSt);
if BtnSt<>0 then
begin
ShowMessage('Введены не корректные данные');
end;
if x[i]<0 then
begin
otr:=otr+1;
end;
if x[i]>0 then
begin
pol:=pol+1;
end;
end;
Label1.Caption:='Отрицательных эл-ов: '+IntToStr(otr);
Label2.Caption:='Положительных эл-ов: '+IntToStr(pol);
end;
end.
Соседние файлы в папке Лаба 8 вар 8