unit Unit2;
interfacetype
TCount = class
  function Value : string;
end;implementationfunction TCount.Value: string;
var
i, j : Integer;begin
Result := '';
  i := 1;
  while i <= 3 do
  begin
    j := i;
    while j <= 5 do
    begin
      Result := Result + ' ' +  IntToStr(j);  <--- 编译器显示这里有问题。
    Inc(j);
    end;  Inc(i);
  end;
end;
end.
unit Unit1;
interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Unit2;type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  ACount : TCount;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
  ACount := TCount.Create;
  Memo1.Lines.Text := Edit1.Text + ' ' + ACount.Value;
  ACount.Free;
end;
end.

本人想Unit1 连载 Unit2 以让Unit1 的控件Memo1 显示 “Edit1 1 2 3 4 5 2 3 4 5 3 4 5”

解决方案 »

  1.   


    unit Unit2;
    interfaceuses SysUtils; //此处添加引用type
    TCount = class
      function Value : string;
    end;implementationfunction TCount.Value: string;
    var
    i, j : Integer;begin
    Result := '';
      i := 1;
      while i <= 3 do
      begin
        j := i;
        while j <= 5 do
        begin
          Result := Result + ' ' +  IntToStr(j);  <--- 编译器显示这里有问题。
        Inc(j);
        end;  Inc(i);
      end;
    end;
    end.
      

  2.   

    在Unit2的Interface部分添加uses SysUtils;引用
      

  3.   


    ××恍然大悟×中×
    忘记加进去,我还以为有另一个方法的代码表达 >.<;;
    谢谢指点。。