|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#1
|
|||
|
|||
Ошибка 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
|
|||
|
|||
Если по простому, просто убери параметры твоих процедур:
Код:
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. |