Einzelnen Beitrag anzeigen

steffi20021

Registriert seit: 18. Okt 2005
8 Beiträge
 
#14

Re: Geldrückgabeautomat programmieren, aber wie?

  Alt 21. Okt 2005, 10:17
So hab mich entschlossen noch mehr über Delphi zu lernen und werd ein bissl Zeit vor meinem Laptop verbringen.

Ich hab jetzt schon ein bissl im Internet geguckt, weil ich einiges nich verstehe, aber hab hauptsächlich Quellcodes gefunden, die mich zwar auch ein bissl weiter gebracht haben aber nich viel.
Mein Problem ist es, dass ich von den meisten Dingen nochnie was gehört habe und somit die Funktionsweise nich verstehe...Also wäre es nett, wenn ihr mir die folgenden Dinge mal kurz erklärt, oder mir ein paar Links gebt *!BITTE!*

Das sind jetzt alles Auszüge aus dem Programm von s14. Hier gleich mal DANKE an s14!

Array [x..y] of ????
Delphi-Quellcode:
Money: Array[0..14] of Cardinal = (50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1);

Amount: Array[0..14] of Cardinal;
Wenn ich es richtig verstehe is bei Money die 0 für 50000, die 1 für 20000,...
Aber wie is das dann bei Amount?

Delphi-Quellcode:
// Hier wird die Anzahl der einzelnen Zahlungsmittel ermittelt
  while Change > 0 do
  for i := Low(Money) to High(Money) do
    if Change >= Money[i] then
    begin
      Inc(Amount[i]);
      Dec(Change, Money[i]);
      Break;
    end;
Hier wär es nett, wenn ihr mir das Inc, Dec und Break erklärt, vll bringt mich das schon weiter.
Oh und das i steht das für [x..y]?


Delphi-Quellcode:
// Anzeige der einzelnen Labels aktualisieren
  for i := Low(Amount) to High(Amount) do
    case i of
      0: SetLabel(Label_500, Format('%d x 500 €', [Amount[i]]), Amount[i]);
      1: SetLabel(Label_200, Format('%d x 200 €', [Amount[i]]), Amount[i]);
      2: SetLabel(Label_100, Format('%d x 100 €', [Amount[i]]), Amount[i]);
      3: SetLabel(Label_50, Format('%d x 50 €', [Amount[i]]), Amount[i]);
      4: SetLabel(Label_20, Format('%d x 20 €', [Amount[i]]), Amount[i]);
      5: SetLabel(Label_10, Format('%d x 10 €', [Amount[i]]), Amount[i]);
      6: SetLabel(Label_5, Format('%d x 5 €', [Amount[i]]), Amount[i]);
      7: SetLabel(Label_e2, Format('%d x 2 €', [Amount[i]]), Amount[i]);
      8: SetLabel(Label_e1, Format('%d x 1 €', [Amount[i]]), Amount[i]);
      9: SetLabel(Label_c50, Format('%d x 50 Cent', [Amount[i]]), Amount[i]);
      10: SetLabel(Label_c20, Format('%d x 20 Cent', [Amount[i]]), Amount[i]);
      11: SetLabel(Label_c10, Format('%d x 10 Cent', [Amount[i]]), Amount[i]);
      12: SetLabel(Label_c5, Format('%d x 5 Cent', [Amount[i]]), Amount[i]);
      13: SetLabel(Label_c2, Format('%d x 2 Cent', [Amount[i]]), Amount[i]);
      14: SetLabel(Label_c1, Format('%d x 1 Cent', [Amount[i]]), Amount[i]);
    end;
Hier blick ich absolut nich durch...! Also wenn jemand langeweile und lust hat, kann er ja probieren es mir zu erklären

Delphi-Quellcode:
// Die Einstellungen der Labels nach Bedarf setzen
  ALabel.Caption := ACaption;
  if Amount > 0 then
  begin
    ALabel.Font.Color := clRed;
    ALabel.Enabled := True;
  end else
  begin
    ALabel.Font.Color := clWindowText;
    ALabel.Enabled := False;
  end;
Steht hier ALabel für alle Label und muss man das vorher definieren, oder is das immer so?
Oh und was is ACaption?


Ok *** das is jetzt fast das ganze Programm von s14.
Aber wenigstens hab ich mal was, um richtige Fargen zu stellen...

Dann erstma Bye!
Steffi
Nur tote Fische schwimmen mit dem Strom!
  Mit Zitat antworten Zitat