Thema: Prism Min-Sort Verfahren

Einzelnen Beitrag anzeigen

cobi23

Registriert seit: 25. Feb 2013
12 Beiträge
 
#31

AW: Min-Sort Verfahren

  Alt 5. Mär 2013, 19:35
Nochmals danke. Jetzt kommen diese Fehlermeldungen:

uselect.pas(22,15) Error: Forward declaration not solved "TForm1.InsMemo(const Open Array Of LongInt,TMemo);"
uselect.pas(23,15) Error: Forward declaration not solved "TForm1.AFuellen(var Open Array Of LongInt,LongInt,LongInt);"
uselect.pas(24,15) Error: Forward declaration not solved "TForm1.ArraySortieren(var Open Array Of LongInt);"
uselect.pas(87,1) Fatal: There were 3 errors compiling module, stopping


Delphi-Quellcode:
unit Uselect;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Zufallszahl: TButton;
    Selectionsort: TButton;
    MemoZufallszahl: TMemo;
    MemoSelect: TMemo;
    procedure SelectionsortClick(Sender: TObject);
    procedure ZufallszahlClick(Sender: TObject);
    procedure InsMemo(const insArray: array of integer; AMemo:TMemo);
    procedure AFuellen(var InsArray:array of integer;Min, Max: integer);
    procedure ArraySortieren( var k:array of integer);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

  A: array [1..20] of integer;

implementation


{$R *.lfm}



  { TForm1 }



procedure TForm1.ZufallszahlClick(Sender: TObject);
  begin
 AFuellen(A,1,100);
 InsMemo(A,MemoSelect);
  end;

procedure TForm1.SelectionsortClick(Sender: TObject);
begin
  ArraySortieren(A);
  InsMemo(A,MemoSelect);
end;

procedure AFuellen(var InsArray:array of integer;Min, Max: integer);
var i:integer;
 begin
   for i:= Low(InsArray) to High (InsArray) do
   begin
     InsArray[i]:= Random(Max-Min+1)+Min;
   end;
 end;


procedure ArraySortieren( var k:array of integer);
Var
    i, j : LongInt;
    Temp, Min: LongInt;
Begin
    For i := Low(k) To High(k) Do
    Begin
        Min := i;
        For j := i+1 To High(k) Do
            If k[j] < k[Min] Then
                Min := j;
        Temp := k[Min];
        k[Min] := k[i];
        k[i] := Temp;
    End;
End;
end.

procedure InsMemo(const insArray: array of integer; AMemo:TMemo);
var
  x:integer;
  begin
    AMemo.Lines.BeginUpdate;
    try
      AMemo.Clear;
      for x:= Low(insArray) to High (insArray) do
      begin
        AMemo.Lines.Add(IntToStr(insArray[x]));

      end;
    finally
      AMemo.Lines.EndUpdate;
    end;
  end;
end.
  Mit Zitat antworten Zitat