Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- :Begin
- cls
- Echo Calculator v0.1
- :inside
- Set /p calc=Enter your command:
- echo %calc%>ccalcc.txt
- Set /a calg=%calc%
- :loop
- echo.
- echo %calg%
- echo %errorlevel%
- pause
- If %errorlevel%==1073750992 cls & goto loop2
- pause
- goto Begin
- :loop2
- set i=1
- Set count=0
- FOR /F "tokens=* delims=+" %%a IN (ccalcc.txt) do set bv=%%a
- echo %bv%
- pause
- set bv=%bv:+= %
- echo %bv%
- FOR %%j IN (%bv%) do Set /A count+=1
- echo %count%
- pause
- :innerloop
- FOR /f "tokens=%i% delims=+" %%a IN ("%calc%") do Set Word!i!=%%a
- echo !word%i%!
- If %count%==%i% set /a a=%i%+1 & goto :loop3
- Set /a i=%i%+1
- goto innerloop
- :loop3
- set i=1
- :Outerloop
- if %i%==%a% goto loop4
- set wf!i!=!word%i%:~0,1!
- echo !wf%i%!
- set wl!i!=!word%i%:~1!
- echo !wl%i%!
- Set /a i=%i%+1
- rem problem is here, only reads the last %i% possible (a-1)
- goto outerloop
- :loop4
- set i=1
- :end
- if %i%==%a% goto otherloop
- If not defined final set final=%wf!i!%,%wl!i!% & goto more
- set /A final=%final%+%wf!i!%,%wl!i!%
- rem The string above still needs to be completed-the (+) sign needs also to be (*-/)
- :more
- set /a i=%i%+1
- goto end
- :otherloop
- set #=%final%
- set length=0
- :finaloop
- if defined # (set #=%#:~1%&set /A length += 1&goto finaloop)
- set /a leng=%length%-3
- :function
- echo %final%*10 to the %leng%
- pause>nul
- set final=
- set i=
- set a=
- goto Begin
Advertisement
Add Comment
Please, Sign In to add comment