本帖最后由 smss 于 2019-4-20 18:17 编辑
上至千极下至小数点后12位 范围0~9999999999999999999999999999999999999999999999999999.999999999999
2019.4.20修复已知BUG- @echo off&setlocal enabledelayedexpansion
- set unit=仟佰拾极仟佰拾载仟佰拾正仟佰拾涧仟佰拾沟仟佰拾穰仟佰拾秭仟佰拾垓仟佰拾京仟佰拾兆仟佰拾亿仟佰拾万仟佰拾元
- set "Z=9999999999999999999999999999999999999999999999999999.999999999999"
- :X
- color 0d
- set /p Z=请输入数字:
- if /i "%Z%"=="q" exit
- if "%Z%"=="0" echo 零元整&goto X
- for /f "tokens=1,2delims=." %%i in ('echo;%Z%^|findstr /b /e "[1-9][0-9]* 0 [1-9][0-9]*\.[0-9]* 0\.[0-9]*"') do (set "a=%%i"&set "b=%%j")
- if defined a (if defined b (if "%b:~12%" NEQ "" (goto U) else if "%a:~52%" NEQ "" (goto U) else (goto Y)
- ) else if "%a:~52%" NEQ "" (goto U) else (goto Y)) else (goto U)
- goto X
- :Y
- set Y=
- for /f "tokens=1,2 delims=." %%a in ("%Z%") do set "Z=%%a"&set "frac=%%b"
- if defined frac (set frac=!frac:~0,12!&set m=!frac:~0,1!&if !m! gtr 0 set Y=!m!角
- set m=!frac:~1,1!&if !m! gtr 0 set Y=!Y!!m!分
- set m=!frac:~2,1!&if !m! gtr 0 set Y=!Y!!m!厘
- set m=!frac:~3,1!&if !m! gtr 0 set Y=!Y!!m!毫
- set m=!frac:~4,1!&if !m! gtr 0 set Y=!Y!!m!丝
- set m=!frac:~5,1!&if !m! gtr 0 set Y=!Y!!m!忽
- set m=!frac:~6,1!&if !m! gtr 0 set Y=!Y!!m!微
- set m=!frac:~7,1!&if !m! gtr 0 set Y=!Y!!m!纤
- set m=!frac:~8,1!&if !m! gtr 0 set Y=!Y!!m!沙
- set m=!frac:~9,1!&if !m! gtr 0 set Y=!Y!!m!尘
- set m=!frac:~10,1!&if !m! gtr 0 set Y=!Y!!m!埃
- set m=!frac:~11,1!&if !m! gtr 0 set Y=!Y!!m!渺)
- set n=0
- for /l %%a in (0,1,100) do if not "!Z:~%%a,1!"=="" set /a n+=1
- if not %Z% equ 0 (for /l %%a in (1,1,%n%) do (set bit=!Z:~-%%a,1!&if not "bit"=="" (set m=!unit:~-%%a,1!&set "Y=!bit!!m!!Y!"
- )))
- set Y=%Y:0=零%
- set Y=%Y:1=壹%
- set Y=%Y:2=贰%
- set Y=%Y:3=叁%
- set Y=%Y:4=肆%
- set Y=%Y:5=伍%
- set Y=%Y:6=陆%
- set Y=%Y:7=柒%
- set Y=%Y:8=捌%
- set Y=%Y:9=玖%
- set Y=%Y:零仟=零%
- set Y=%Y:零佰=零%
- set Y=%Y:零拾=零%
- set Y=%Y:零零零=零%
- set Y=%Y:零零=零%
- set Y=%Y:零极=极%
- set Y=%Y:零载=载%
- set Y=%Y:零正=正%
- set Y=%Y:零涧=涧%
- set Y=%Y:零沟=沟%
- set Y=%Y:零穰=穰%
- set Y=%Y:零秭=秭%
- set Y=%Y:零垓=垓%
- set Y=%Y:零京=京%
- set Y=%Y:零兆=兆%
- set Y=%Y:零亿=亿%
- set Y=%Y:零万=万%
- set Y=%Y:零元=元%
- set Y=%Y:零壹=壹%
- set Y=%Y:零贰=贰%
- set Y=%Y:零叁=叁%
- set Y=%Y:零肆=肆%
- set Y=%Y:零伍=伍%
- set Y=%Y:零柒=柒%
- set Y=%Y:零捌=捌%
- set Y=%Y:零玖=玖%
- set Y=%Y:极载正涧沟穰秭垓京兆亿万=极%
- set Y=%Y:载正涧沟穰秭垓京兆亿万=载%
- set Y=%Y:正涧沟穰秭垓京兆亿万=正%
- set Y=%Y:涧沟穰秭垓京兆亿万=涧%
- set Y=%Y:沟穰秭垓京兆亿万=沟%
- set Y=%Y:穰秭垓京兆亿万=穰%
- set Y=%Y:秭垓京兆亿万=秭%
- set Y=%Y:垓京兆亿万=垓%
- set Y=%Y:京兆亿万=京%
- set Y=%Y:兆亿万=兆%
- set Y=%Y:极载=极%
- set Y=%Y:载正=载%
- set Y=%Y:正涧=正%
- set Y=%Y:涧沟=涧%
- set Y=%Y:正涧=正%
- set Y=%Y:沟穰=沟%
- set Y=%Y:穰秭=穰%
- set Y=%Y:秭垓=秭%
- set Y=%Y:垓京=垓%
- set Y=%Y:京兆=京%
- set Y=%Y:兆亿=兆%
- set Y=%Y:亿万=亿%
- set Y=%Y:穰垓=穰%
- set Y=%Y:载正涧沟穰秭垓京兆亿=%
- set Y=%Y:载正涧沟穰秭垓京兆=%
- set Y=%Y:载正涧沟穰秭垓京=%
- set Y=%Y:载正涧沟穰秭垓=%
- set Y=%Y:载正涧沟穰秭=%
- set Y=%Y:载正涧沟穰=%
- set Y=%Y:载正涧沟穰=%
- set Y=%Y:载正涧沟=%
- set Y=%Y:载正涧=%
- set Y=%Y:正涧沟穰秭垓京兆亿=%
- set Y=%Y:涧沟穰秭垓京兆亿=%
- set Y=%Y:沟穰秭垓京兆亿=%
- set Y=%Y:穰秭垓京兆亿=%
- set Y=%Y:秭垓京兆亿=%
- set Y=%Y:垓京兆亿=%
- set Y=%Y:京兆亿=%
- set Y=%Y:正沟秭京亿=%
- set Y=%Y:正沟秭京=%
- set Y=%Y:正沟秭=%
- set Y=%Y:正沟=%
- color 0b
- if !frac! equ 0 (echo %Y%整) else echo %Y%
- ping 0 -n "2">nul&goto X
- :U
- echo 已超出范围,请重新输入&goto X
复制代码
|