詳情介紹
能實現(xiàn)阿拉伯?dāng)?shù)字與羅馬數(shù)字互轉(zhuǎn)程序的批處理文件 ,雙擊運行
:: 阿拉伯與羅馬數(shù)字互轉(zhuǎn)程序
:: qzwqzw <a >//bbs.cn-dos.net</a>
:: 2007-01-03 Revision 2
:: 出處:<a >//www.cn-dos.net/forum/viewthread.php?tid=26230</a>
@echo off
setlocal EnableDelayedExpansion</p> <p>for /l %%i in (1,1,100) do (
set /a numin=!random!*4200/32768-100
set in=!numin!
set out=
call :Arab2Roman
set in=!out!
call :Roman2Arab
echo.%%i [!numin!:!in!:!out!]
if !numin! neq !out! set /p=--- Invalid ---
)
pause
endlocal
goto :eof</p> <p>:Arab2Roman
setlocal EnableDelayedExpansion
set num=%in%
set /a tmp=num+0
if not "%num%"=="%tmp%" goto :eof
if %num% geq 4000 goto :eof
if %num% leq 0 goto :eof</p> <p>set i=0
for %%v in (1000 900 500 400 100 90 50 40 10 9 5 4 1) do (
set /a i+=1
set arab!i!=%%v
)</p> <p>set i=0
for %%v in (M CM D CD C XC L XL X IX V IV I) do (
set /a i+=1
set roman!i!=%%v
)</p> <p>set i=1
:a2r_loop
call set tmp=%%arab%i%%%</p> <p>if 1%num% lss 1%tmp% (
set /a i+=1
) else (
call set rom=%rom%%%roman%i%%%
set /a num-=tmp
)</p> <p>if 1%num% gtr 10 goto a2r_loop</p> <p>endlocal & set out=%rom%
goto :eof
::Arab2Roman</p> <p>:Roman2Arab
setlocal EnableDelayedExpansion</p> <p>echo.%in%|findstr /r "[^IVXLCDMivxlcdm]">nul && goto :eof</p> <p>set i=0
for %%v in (1000 900 500 400 100 90 50 40 10 9 5 4 1) do (
set /a i+=1
set arab!i!=%%v
)</p> <p>set i=0
for %%v in (M 1 D 2 C 3 L 4 X 5 V 6 I) do (
set /a i+=1
set roman!i!=%%v
)</p> <p>set in=%in:m=M%
set in=%in:d=D%
set in=%in:c=C%
set in=%in:l=L%
set in=%in:x=X%
set in=%in:v=V%
set in=%in:i=I%</p> <p>set in=%in:CM=1%
set in=%in:CD=2%
set in=%in:XC=3%
set in=%in:XL=4%
set in=%in:IX=5%
set in=%in:IV=6%</p> <p>set i=1
set num=0
:r2a_loop
set tmp=%in:~0,1%
call set rom1=%%roman%i%%%
if "%tmp%"=="%rom1%" (
call set /a num+=arab%i%
set in=%in:~1%
) else (
set /a i+=1
)
if %i% gtr 13 goto :eof
if not "%in%"=="" goto r2a_loop</p> <p>endlocal & set out=%num%
goto :eof
::Roman2Arab
警告:運行BAT源碼是一種危險的動作,如果你不熟悉,請不要嘗試!
下載地址
人氣BAT
相關(guān)文章
-
阿拉伯?dāng)?shù)字與羅馬數(shù)字互轉(zhuǎn)程序的批處理命令 阿拉伯與羅馬數(shù)字互轉(zhuǎn)程序bat
能實現(xiàn)阿拉伯?dāng)?shù)字與羅馬數(shù)字互轉(zhuǎn)程序的批處理文件 ...
下載聲明
☉ 解壓密碼:chabaoo.cn 就是本站主域名,希望大家看清楚,[ 分享碼的獲取方法 ]可以參考這篇文章
☉ 推薦使用 [ 迅雷 ] 下載,使用 [ WinRAR v5 ] 以上版本解壓本站軟件。
☉ 如果這個軟件總是不能下載的請在評論中留言,我們會盡快修復(fù),謝謝!
☉ 下載本站資源,如果服務(wù)器暫不能下載請過一段時間重試!或者多試試幾個下載地址
☉ 如果遇到什么問題,請評論留言,我們定會解決問題,謝謝大家支持!
☉ 本站提供的一些商業(yè)軟件是供學(xué)習(xí)研究之用,如用于商業(yè)用途,請購買正版。
☉ 本站提供的阿拉伯?dāng)?shù)字與羅馬數(shù)字互轉(zhuǎn)程序的批處理命令 阿拉伯與羅馬數(shù)字互轉(zhuǎn)程序bat資源來源互聯(lián)網(wǎng),版權(quán)歸該下載資源的合法擁有者所有。