Thema: Delphi schleife

Einzelnen Beitrag anzeigen

matze222

Registriert seit: 8. Mär 2008
33 Beiträge
 
#1

schleife

  Alt 11. Apr 2008, 14:40
hi leute ich wüsste gerne wie ich ne schleife machen kann...
ich will nämlich das er etwas nachprüft und zwar immerwieder solange bis er bei 0 ist.
ich habe nämlich ein programm geschrieben in dem ich geld "einwerfe" und somit bezahle und nun krieg ich da eine ausgabe raus, die ich gern in die einzelnen münzen trennen würde...
bisher hab ich das so gemacht:
Delphi-Quellcode:
if (c>50) then
        edit5.Text:=floattostr(e+1);
        d:=(d-50);
        if (c>20) and(c<50) then
        edit6.Text:=floattostr(e+1);
        d:=(d-20);
        if (c>10) and(c<20) then
        edit7.Text:=floattostr(e+1);
        c:=(c-10);
        if (c>5) and(c<10) then
        edit8.Text:=floattostr(e+1);
        c:=(c-5);
        if (c>2) and(d<5) then
        edit9.Text:=floattostr(e+1);
        c:=(c-2);
        if (c>1) and(c<2) then
        edit10.Text:=floattostr(e+1);
        c:=(c-1);
        if (c>0.5) and(c<1) then
        edit11.Text:=floattostr(e+1);
        c:=(c-0.5);
        if (c>0.2) and(c<0.5) then
        edit12.Text:=floattostr(e+1);
        c:=(c-0.2);
        if (c>0.1) and(c<0.2) then
        edit13.Text:=floattostr(e+1);
        c:=(c-0.1);
und der scheint das irgendwie nicht richtig auszuführen...
oder hat emand nen anderen einfacheren oder besseren vorschlag?
thx im vorraus
  Mit Zitat antworten Zitat