Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Oktalzahl zu Dezimalzahl (https://www.delphipraxis.net/18387-oktalzahl-zu-dezimalzahl.html)

Phistev 6. Apr 2006 10:51

Re: Oktalzahl zu Dezimalzahl
 
Zitat:

Zitat von Jens Schumann
Zitat:

Zitat von KermitFrosch
dezimal -->12344

oktal --> 5348

Ist Euch eigentlich schon mal aufgefallen, dass die hier gezeigte Umrechnung einer Dezimalzahl in eine Octalzahl völlig falsch ist?

Die richtige Lösung lautet: 12344(dezimal) ist 30070(octal)

Oder 12344 ist die Oktalzahl, dann wäre 5348 die korrekte Dezimalzahl

Nieswood 6. Apr 2006 11:14

Re: Oktalzahl zu Dezimalzahl
 
danke leutz für die anderen tollen vorschläge, nur mich würde gerne die zuerst diskutierte procedure interessieren! das macht mich ganz kirre ... :spin:

Klaus01 6. Apr 2006 11:23

Re: Oktalzahl zu Dezimalzahl
 
Delphi-Quellcode:
procedure TForm1.btnoctalClick(Sender: TObject);
function xToDec(octal: string; sys: byte): integer;
var
  i: integer;
const
  ch = '0123456789ABCDEF';
begin
  octal:=(edtoctal.Text);
  sys:=8;
  result := 0;
  if sys in [2..16] then
    begin
      for i := 1 to length(octal) do
        result := result*sys + pos(upCase(octal[i]),ch) - 1;
    end;
end;
wenn es das ist was Du meinst.

Grüße
Klaus


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:41 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz