Показать сообщение отдельно
  #2  
Старый 23.06.2019, 19:55
lmikle lmikle вне форума
Модератор
 
Регистрация: 17.04.2008
Сообщения: 8,100
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
По умолчанию

Если по простому, просто убери параметры твоих процедур:
Код:
unit Unit1;
 
interface
 
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids;
 
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    Label1: TLabel;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Linear;
    procedure Parabolic;
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
// =============================================================================
 
procedure TForm1.Linear;
var
  k: array [1 .. 7] of Integer;
  z, a, b: Integer;
begin
  for z := 1 to 7 do
    a := StrToInt(StringGrid1.Cells[z, 2]);
  b := StrToInt(StringGrid1.Cells[z, 1]);
  k[z] := a div b;
  if (k[1] + k[2] + k[3] + k[4] + k[5] + k[6] + k[7]) / 7 = k[1] then
    Edit1.Text := 'Линейная зависимость';
end;
 
procedure TForm1.Parabolic;
var
  k: array [1 .. 7] of Integer;
  z, s, a, b: Integer;
begin
  for z := 1 to 7 do
  begin
    a := StrToInt(StringGrid1.Cells[z, 2]);
    k[z] := sqrt(a);
  end;
  for z := 1 to 7 do
  begin
    b := StrToInt(StringGrid1.Cells[z, 1]);
    if k[z] = b then
      s := s + 1
  end;
  if s = 7 then
    Edit1.Text := 'Квадратичная зависимость';
end;
 
  procedure TForm1.Button1Click(Sender: TObject);
  begin
    TForm1.Linear;
    TForm1.Parabolic;
  end;
 
end.
Ответить с цитированием