Autor Beitrag
jackie05
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 28.10.10 06:55 
Hallo,
ich habe folgendes problem und zwar möchte ich z.B. so einen Zähler hoch zählen lassen von hinten:

00000001
00000002
00000003
0000000....
00000009
00000010
00000011
00000012
u.s.w.

Ich habe das so versucht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
  Zahl[high(Zahl)] := Zahl[high(Zahl)] + 1;
  if Zahl[high(Zahl)] > 9 then
  begin
    for i:=0 to high(Zahl) do begin
      if Zahl[i] >= 9 then
      begin
        Zahl[i-1] := Zahl[i-1] + 1;
        Zahl[i] := 0;
        break;
      end;
    end;
    Zahl[high(Zahl)] := 0;
  end;
  Label1.Caption := '';
  for i:=0 to high(Zahl) do begin
    Label1.Caption := Label1.Caption + IntToStr(Zahl[i]) + '  ';
  end;


leider funktioniert das nicht so richtig.

Kann mir Vielleicht jemand erklären wie ich das am einfachsten lösen kann?

Ich bedanke mich schonmal im Voraus.

MfG
Tankard
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Administrator
Beiträge: 217
Erhaltene Danke: 96



BeitragVerfasst: Do 28.10.10 07:09 
schau dir das mal an

www.delphibasics.co.uk/RTL.asp?Name=Format

speziel

ausblenden Delphi-Quelltext
1:
2:
// The precision value forces 0 padding to the desired size
  ShowMessage(Format('0 padded decimal  = <%.6d>', [1234]));



gruss
tankard


Zuletzt bearbeitet von Tankard am Do 28.10.10 07:50, insgesamt 1-mal bearbeitet
MaxWurzel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 77
Erhaltene Danke: 10



BeitragVerfasst: Do 28.10.10 07:38 
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 28.10.10 14:10 
Danke euch, funktioniert Wunderbar.

MfG