FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Lo que busco es traducir ese codigo a delphi
te agradecería mucho |
#2
|
||||
|
||||
Ve haciéndolo y te vamos ayudando con los problemas que tengas.
|
#3
|
|||
|
|||
Así va mi codigo:
function Conversion(Numero, desde, hasta: string): string; var k : Integer; //ya n : Integer; //creo digito : string; valor : Integer; pos : Integer; alfabeto : String;//TStringList; alfalis : TStringList; maximo : Integer; p : Integer; resultado : String; actual : Real; division : integer; //z : extended; resta : integer; resultadok: Real; indice : string; begin // Round : redondea un Número de punto flotante a un valor entero. // Length : // Power : Potencia // div : Divicion entera // Mod : Modulo o resuduo alfabeto:='abcdefghijklmnñopqrstuvwxyz'; maximo:=Length(alfabeto); if not (StrToInt(desde) < maximo) and (StrToInt(desde) >1) then begin Showmessage('Base origen imposible'); Exit; end; if not (StrToInt(hasta) < maximo) and (StrToInt(hasta) >1) then begin Showmessage('Base destino imposible'); Exit; end; k:=0; n:= Length(Numero); for pos in [0..n] do begin digito:=numero[pos]; end; if not (edNumero.Text<> digito) and (edNumero.Text<>alfabeto)then begin Showmessage(Digito + ' No es valido en ninguna base'); Exit; end; { valor:=alfabeto.IndexOf(digito); } if not valor < StrToInt(desde) then begin Showmessage(Digito + ' No es valido en base origen'); Exit; end; k:= valor*StrToInt(desde); resta:= (n - pos - 1); resultadok:= Power(k,resta); p:=0; while hasta < IntToStr(k) do begin p:= p+1; resultado:= ''; end; while p > 0 do begin p:=p-1; actual:= (power(StrToInt(hasta),p)); resultado:=resultado+alfabeto+IntToStr((k div Round(actual))); k:= k mod Round(actual); Result:=resultado; end; end; |
#4
|
||||
|
||||
Por favor, usa las etiquetas adecuadas para publicar código:
LineComment Saludos |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Como compilo este codigo dll en delphi ? | helio | Varios | 5 | 31-08-2016 22:04:24 |
Ayuda a pasar este código a firemonkey. | elmago00 | FireMonkey | 55 | 08-01-2015 15:25:18 |
Pasar este mini-codigo a C++Builder | aguml | C++ Builder | 10 | 24-06-2014 21:09:12 |
Como implementar este codigo en delphi 7 | freddiaz07 | Internet | 4 | 16-09-2011 22:34:39 |
Porque este código me da error (adjunto código) | David | JAVA | 1 | 12-03-2009 20:07:27 |
|