Autor Beitrag
ReddY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win 2000

BeitragVerfasst: Sa 20.05.06 12:06 
Huhu!

Ich wollte fragen ob jemand eine gute Möglichkeit weiß wie man z.B. Zahlen wie 137, 784 ... die jedenfalls unter der zahl 1024 liegen in binär umwaneln kann! mit if-abfragen gibt es bei mir immer probleme.

ich wäre nett wenn ihr mir helfen könnten.

gruß

_________________
Ordnung braucht nur der Dumme. Das Genie beherrscht das Chaos! (Albert Einstein)
cuejo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 142

Win XP
Delphi 7 Personal und 2005 PE
BeitragVerfasst: Sa 20.05.06 12:50 

_________________
Computer sind dumm, aber fleißig. Deshalb arbeite ich so gerne damit.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 20.05.06 13:03 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
function IntToBin(i: int64): string;
begin
  result := '';
  while i > 0 do begin
    result := inttostr(ord(odd(i))) + result;
    i := i shr 1;
  end;
  if result = '' then result := '0';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Caption := IntToBin(strtoint(edit1.text));
end;