1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
const max = 7;
type TForm1 = class(TForm) Edit1: TEdit; Button2: TButton; ListBox1: TListBox; Edit2: TEdit; Button3: TButton; procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private public end;
type Tklasse = record drache : string[20]; mensch : string[20]; untoter : string[20]; zwerg : string[20]; daemon : string[20]; elf : string[20]; ork : string[20]; end;
var Form1: TForm1; k: Array[1..7] of Integer; x : integer; klasse : array[1..7] of Tklasse; implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject); var i : integer; begin for i := 1 to max do begin klasse.drache := (edit1.text); end; end;
procedure TForm1.Button2Click(Sender: TObject); var z,j :integer; label jump; begin randomize; for x := 1 to max do begin jump: z:=random(7)+1; for j:=1 to x-1 do if z = k[j] then goto jump; k[x]:=z;
edit2.text := (klasse.drache); listbox1.items.add(IntToStr(k[x])); end; end;
end. |
wie kann ich die 2 arrays miteinander verbinden, sodass ich jedem type ne nummer zugewiesen hab und ihn so in der position verändern kann, soweit das möglich ist?