Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > [ "Начинающим" ]
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 23.06.2019, 11:16
mxkrzh mxkrzh вне форума
Прохожий
 
Регистрация: 25.05.2019
Сообщения: 5
Версия Delphi: RAD Studio 10.3
Репутация: 10
Восклицание Ошибка Not enough actual parameters

При компиляции выдаёт ошибку Not enough actual parameters

Код:
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(StringGrid1: TStringGrid; Edit1: TEdit);
    procedure Parabolic(StringGrid1: TStringGrid; Edit1: TEdit);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
// =============================================================================

procedure TForm1.Linear(StringGrid1: TStringGrid; Edit1: TEdit);
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(StringGrid1: TStringGrid; Edit1: TEdit);
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(StringGrid1: TStringGrid, Edit1: TEdit);
    TForm1.Parabolic(StringGrid1: TStringGrid, Edit1: TEdit);
  end;

end.
Ответить с цитированием
  #2  
Старый 23.06.2019, 19:55
lmikle lmikle сейчас на форуме
Модератор
 
Регистрация: 17.04.2008
Сообщения: 8,015
Версия 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.
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 00:58.


 

Сайт

Форум

FAQ

RSS лента

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2023

ВКонтакте   Facebook   Twitter