Autor |
Beitrag |
Windoof
Beiträge: 34
Windows 95/98 SE/NT4.0 WS/2000 Professional/XP Home & Professional, SuSE Linux 7.0/9.0 Professional, OpenBSD
Dev-C++ 4.9.9.0, Borland C++ Builder 3 Personal/5 Professional/6 Enterprise, Borland Delphi 6 Enterprise/7 Enterprise
|
Verfasst: Do 03.03.05 11:41
_________________ C++ Club - Tomorrow we'll be your favourite!
*gleichnamige Website international*
|
|
retnyg
Beiträge: 2754
SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
|
Verfasst: Do 03.03.05 11:59
versuche es mal mit AND
und inttostr(i) (=itoa) statt "as string"
|
|
Windoof
Beiträge: 34
Windows 95/98 SE/NT4.0 WS/2000 Professional/XP Home & Professional, SuSE Linux 7.0/9.0 Professional, OpenBSD
Dev-C++ 4.9.9.0, Borland C++ Builder 3 Personal/5 Professional/6 Enterprise, Borland Delphi 6 Enterprise/7 Enterprise
|
Verfasst: Do 03.03.05 12:33
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
| function IntToBin(zahl,stellen:Integer):String; var i:Integer; b:String; begin i:=1; while i<zahl do i:=i*2; while i>0 do begin b:=String(Char(Integer('0')+Integer(zahl and i)))+b; i:=Round(i/2); end; for i:=Length(b) to stellen-1 do b:='0'+b; Result:=b; end; | Ist es nicht. Ziel derSacheist es einfach den Binärweet einer Dezimalzahl zu ermitteln, d.h. ich will mir eine Liste aller ASCII-Zeichen machen mit folgenden Spalten: Zeichen, Dezimal, Hexadezimal und Binär. and ist es nicht, ich denke eher an einem anderen schlüsselwort alá mod... nur nicht mod sondern halt bitweises AND, kein logisches AND. Wie heißt das BitweiseAND in Delphi?
_________________ C++ Club - Tomorrow we'll be your favourite!
*gleichnamige Website international*
|
|
Gausi
Beiträge: 8538
Erhaltene Danke: 475
Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
|
Verfasst: Do 03.03.05 12:39
Doch, AND ist das, was du suchst:
Delphi-Quelltext 1: 2:
| bool1 AND bool2 int1 AND int2 |
_________________ We are, we were and will not be.
|
|
Windoof
Beiträge: 34
Windows 95/98 SE/NT4.0 WS/2000 Professional/XP Home & Professional, SuSE Linux 7.0/9.0 Professional, OpenBSD
Dev-C++ 4.9.9.0, Borland C++ Builder 3 Personal/5 Professional/6 Enterprise, Borland Delphi 6 Enterprise/7 Enterprise
|
Verfasst: Do 03.03.05 12:52
*omg* sorry leute... ich hab zwar ohne and gearbeitet, weil das bei mir wirklich nicht geklappt hat, aber ichhatte noch einen adneren fehler drin, hier die funktion, wie sie funktioniert: Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| function IntToBin(zahl,stellen:Integer):String; var i:Integer; b:String; begin i:=1; while i<zahl do i:=i*2; if i>zahl then i:=Round(i/2); while i>0 do begin inc(zahl,-i); b:=b+String(Char(Integer('0')+Integer(zahl>-1))); if zahl<0 then inc(zahl,i); i:=Round(i/2); end; while stellen>Length(b) do b:='0'+b; Result:=b; end; |
_________________ C++ Club - Tomorrow we'll be your favourite!
*gleichnamige Website international*
|
|
Spaceguide
Beiträge: 552
(D3/D7/D8) Prof.
|
Verfasst: Do 03.03.05 13:18
Oder so...
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| function IntToBin(zahl,ziffern : integer) : string; begin SetLength(Result,ziffern); while (ziffern>0) do begin Result[ziffern]:=IntToStr(zahl and 1)[1]; zahl := zahl shr 1; dec(ziffern); end; end; |
|
|
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1
|
Verfasst: Do 03.03.05 14:48
fängste schon wieder mit kürzeren oder besseren Funktionen an, Spaceguide?
|
|
retnyg
Beiträge: 2754
SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
|
Verfasst: Do 03.03.05 14:51
durchaus berechtigt, die funktion von windoof ist ja furchtbar (naja so denkt halt wohl ein c-coder)
|
|
delfiphan
Beiträge: 2684
Erhaltene Danke: 32
|
Verfasst: Do 03.03.05 14:58
Die Funktion macht aber nicht dasselbe. Wenn du weniger Stellen angibst als benötigt, um die Zahl darzustellen, bekommst du Probleme.
|
|
Spaceguide
Beiträge: 552
(D3/D7/D8) Prof.
|
Verfasst: Do 03.03.05 17:25
Da bekomm ich keine Probleme, sondern die niederwertigen Bits.
|
|
delfiphan
Beiträge: 2684
Erhaltene Danke: 32
|
Verfasst: Do 03.03.05 17:35
Aber Kompatibilitätsprobleme, wenn du seine Funktion durch deine ersetzst...
|
|
Spaceguide
Beiträge: 552
(D3/D7/D8) Prof.
|
Verfasst: Do 03.03.05 18:55
Also meine Funktion verhält sich eigentlich genauso wie die von Windoof.
|
|