2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

.bat(バッチファイル)で、10進数→n(2~16)進数変換を眺める

Last updated at Posted at 2015-07-10

 特に意味が無いプログラム…見てニヤッとして(?)終わります。
 挙動は、是非ご覧になって確かめてください()

code
@echo off
setlocal enabledelayedexpansion
set /a n=1,a=0
mode con:lines=16
:top
set /a a+=1
set n=1
for /l %%i in (2,1,16) do set an%%i=
:a
set /a n+=1
:b
set loop=0
set ac=%a%
:c
set /a loop+=1
if %ac% lss %n% set x%loop%=%ac%& goto d
set /a x%loop%=ac%%n
set /a ac/=n
goto c
:d
set str=0123456789ABCDEF
call call set x%loop%=%%%%str:~%%x%loop%%%,1%%%%
set an%n%=!an%n%!!x%loop%!
set /a loop-=1
if %loop% neq 0 goto d

if %n% neq 16 goto a
cls
for /l %%i in (2,1,16) do (
set echon=%%i
if %%i leq 9 set echon=0%%i
echo !echon!進数…!an%%i!
)
goto top
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?