Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Lazarus, FreePascal, Kylix, etc. (https://www.clubdelphi.com/foros/forumdisplay.php?f=14)
-   -   free pascal binario a hexadecimal (https://www.clubdelphi.com/foros/showthread.php?t=65902)

bothy 21-01-2010 05:43:15

free pascal binario a hexadecimal
 
hola alguien me puede ayudar con un codigo de lo mas facil que haga converciones de binario a hexadecimal

bothy 21-01-2010 07:15:15

tengo este codigo pero lo malo que nomas me sirve para esa converciones nomas quisiera que me ayudaran para poder poner un digito mas grande como 10000 ese binario seria un diez en hexadecimal ..


var num,aux:longint;
var suma,x:string;
begin
repeat
clrscr;
writeln('Leer Numero Binario');readln(num);

if num=1then
begin suma:='1';end;
if num=10 then
begin suma:='2'; end;
if num= 11 then
begin suma:='3'; end;
if num=100 then
begin suma:='4'; end;
if num=101 then
begin suma:='5'; end;
if num= 110 then
begin suma:='6'; end;
if num=111 then
begin suma:='7' ; end;
if num=1000 then
begin suma:= '8'; end;
if num=1001 then
begin suma:='9'; end;
if num=1010 then
begin suma:='A'; end;
if num=1011 then
begin suma:='B'; end;
if num=1100 then
begin suma:='C' ; end;
if num=1101 then
begin suma:='D';end;
if num=1110 then
begin suma:='E'; end;
if num=1111 then
begin suma:='F' ;end;
writeln('Numero Hexadeimal ::');
writeln(suma);
writeln('Desea continuar s/n?');readln(x);
until x='n';
end;

ElKurgan 21-01-2010 07:16:24

En este hilo se trató este tema. También estan las funciones HexToBin y BinToHex, pero desconozco si existen en FreePascal.

También puedes ver estos ejemplos de código:
Pasar de Binario a Hexadecimal
Pasar de Hexadecimal a Binario

Saludos

bothy 21-01-2010 19:33:44

Gracias de algo me sirvieron esos links


La franja horaria es GMT +2. Ahora son las 12:59:19.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi