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: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117:
| var Form1: TForm1; wurzel : Array[1..6] of Zeiger;
const Distances : TDistances = ((0,0,28,0,0,24), (0,0,15,20,0,0), (28,15,0,12,0,0), (0,20,12,0,13,0), (0,0,0,13,0,11), (24,0,0,0,11,0));
implementation
uses Ways;
Procedure TForm1.Print_Distances_Matrix; Var a,b : Integer; Begin For a:=1 to 6 do For b:=1 to 6 do Tedit(Form1.findcomponent('Cell'+IntToStr(a)+IntToStr(b))).text:=IntToStr(Distances[a,b]); End;
Procedure TForm1.List_Print; Var a : Integer; Hilf : Zeiger; Begin For a:=1 to 6 DO Begin hilf:=wurzel[a]; While Hilf <> NIL do begin Tedit(FindComponent('ListEdit'+IntToStr(a))).Text :=Tedit(FindComponent('ListEdit'+IntToStr(a))).Text + ' -> ' + IntToStr(hilf^.Distance) + '(' + Hilf^.City_Name + ')'; Hilf := Hilf^.Next; end; End; End;
Procedure TForm1.MatrixListe1Click(Sender: TObject); Var a,b : Integer; Hilf, lauf: Zeiger; Begin For a:=1 to 6 do Begin Wurzel[a] := NIL; For b:=1 to 6 do If Distances[a,b] <> 0 then begin New(Hilf); Hilf^.Distance := Distances[a,b]; Case b of 1 : Hilf^.City_Name:= 'Laie'; 2 : Hilf^.City_Name:= 'Maiti'; 3 : Hilf^.City_Name:= 'Wahiawa'; 4 : Hilf^.City_Name:= 'Perl-City'; 5 : Hilf^.City_Name:= 'Honolulu'; 6 : Hilf^.City_Name:= 'Kanehohe'; end; If Wurzel[a] = NIL then begin Wurzel[a] := Hilf; lauf:=Hilf; Hilf^.Next := NIL; end else begin Lauf^.Next := Hilf; Lauf := Lauf^.next; Hilf^.Next := NIL; end; end; End;
List_Print; End;
procedure TForm1.FormActivate(Sender: TObject); begin Form1.Print_Distances_Matrix; Form1.List_Print; end;
procedure TForm1.Beenden1Click(Sender: TObject); begin halt; end;
{$R *.DFM}
procedure TForm1.Wegberechnung1Click(Sender: TObject); Var NewForm : TForm2; begin NewForm.Create(self); NewForm.ShowModal; NewForm.Free; end;
procedure TForm1.Button1Click(Sender: TObject); Var NewForm : TForm2; begin NewForm.Create(self); NewForm.ShowModal; NewForm.Free;
end;
end. |