联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off setlocal EnableDelayedExpansion if %2.==. goto input set /A N=%1 set /A D=%2 goto compute :input echo Input N: set /p NN= set /A N=%NN% echo Input D: set /p DD= set /A D=%DD% goto compute :compute if %N%==0 echo Wrong Intry && goto input if %D%==0 echo Wrong Intry && goto input set str= for /L %%a in (1,1,%D%) do @set /A Left%%a=0 for /L %%a in (1,1,%D%) do @set /A Result%%a=0 set /A int_part="%N%/%D%" set /A N="%N%%%%D%" set /A tool=%N% if %tool%==0 echo The result of expression "%N%/%D%" is %int_part% && goto :EOF set /A turn=1 :start set /A "tool*=10" set /A Result%turn%="%tool%/%D%" set /A Left="%tool%%%%D%" if %Left%==0 set /A begin=-1 && set /A end="%turn%" && goto endCompute if %Left%==%N% set /A begin=0 && set /A end="%turn%" && goto endCompute if not !Left%Left%!==0 set /A begin="!Left%Left%!" && set /A end="%turn%" && goto endCompute set /A Left%Left%=%turn% set /A tool=%Left% set /A "turn+=1" goto start :endCompute if %3.==. echo The result of expression "%N%/%D%" is set result=# for /L %%i in (1,1,%end%) do @set result=!result!!Result%%i! set result=%result:~1% if %begin%==-1 echo %int_part%.%result% && goto end if %begin%==0 echo %int_part%.[%result%] && goto end echo %int_part%.!result:~0,%begin%![!result:~%begin%!] :end if %2.==. echo. && echo Press any key to quit application && pause>nul