[Batch] Convertidor decimal a binarios y binarios a decimal bien simple

Iniciado por bITEBUG, 15 Junio 2011, 06:13 AM

0 Miembros y 1 Visitante están viendo este tema.

bITEBUG

Código (dos) [Seleccionar]
@echo off
if %1==/r goto reciproco

:DIRECTO
:Primitiva
set count=
set binary=

:Aritmetica
set binary=%binary%+I
set /a count=%count%+1
:Axiomatica
set binary=%binary:O+I=I%
set binary=%binary:I+I=+IO%

:Logica
if not %binary:O+I=%==%binary% goto Axiomatica
if not %binary:I+I=%==%binary% goto Axiomatica

:Lenguaje formal
set binary=%binary:+=%

:Recursion
if not %count%==%1 goto aritmetica

:Tesis
set binary=%binary:O=0%
set binary=%binary:I=1%
echo %binary%

goto credits

:RECIPROCO
shift
:_Primitiva
set count=
set binary=%1

:_Hipotesis
set binary=%binary:0=O%
set binary=%binary:1=I%

:_Aritmetica
set binary=%binary%-I


:_Axiomatica
set binary=%binary:O-I=-II%
set binary=%binary:I-I=O%

:_Logica

if not %binary:O-I=%==%binary% goto _Axiomatica
if not %binary:I-I=%==%binary% goto _Axiomatica
set /a count=%count%+1
:_Lenguaje formal
set binary=%binary:-=%

:_Recursion
if not %binary:I=%==%binary% goto _aritmetica

:_Tesis


echo %count%
goto credits



:credits