Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- Setlocal enabledelayedexpansion
- :input
- set /p x=X:
- set /p y=Y:
- set /p sign=Operation (+ - * / ):
- Ser check=0
- call :blergle
- goto input
- :blergle
- For /f "delims=. tokens=1,2" %%a in ("%x%") do (
- Set int1=%%a
- Set float1=%%b
- )
- For /f "delims=. tokens=1,2" %%a in ("%y%") do (
- Set int2=%%a
- Set float2=%%b
- )
- Set a=0
- if not defined float1 (
- set a=1
- goto endbleh1
- )
- :bleh1
- set g=!float1:~%a%,1!
- If not defined g goto endbleh1
- Set /a a+=1
- Goto bleh1
- :endbleh1
- Set b=0
- if not defined float2 (
- set b=1
- goto endbleh2
- )
- :bleh2
- set f=!float2:~%b%,1!
- If not defined f goto endbleh2
- Set /a b+=1
- Goto bleh2
- :endbleh2
- set t=0
- set h=1
- set i=1
- set zomg=0
- set testnum=%a%
- :zomg1
- if "%t%"=="%testnum%" goto zomg2
- if "%zomg%"=="0" set h=%h%0
- if "%zomg%"=="1" set i=%i%0
- set /a t+=1
- goto zomg1
- :zomg2
- if "%zomg%"=="%b%" goto zomg3
- set t=0
- set testnum=%b%
- set zomg=1
- goto zomg1
- :zomg3
- set /a tester1=%h%-%i%
- set input1=%int1%%float1%
- set input2=%int2%%float2%
- if %tester1% EQU 0 goto n1
- if %tester1% LSS 0 goto l1
- if %tester1% GTR 0 goto g1
- :n1
- if "%sign%"=="*" (set /a divisor=%h%*%h%) else (set divisor=%h%)
- Goto other
- :l1
- set add=!i:%h%=!
- set input1=%input1%%add%
- if "%sign%"=="*" (set /a divisor=%i%*%i%) else (set divisor=%i%)
- Goto other
- :g1
- set add=!h:%i%=!
- set input2=%input2%%add%
- if "%sign%"=="*" (set /a divisor=%h%*%h%) else (set divisor=%h%)
- Goto other
- :other
- If "%sign%"=="/" (set numerator=%input1%
- Set divisor=%input2%
- ) else (
- set /a numerator=%input1%%sign%%input2%
- )
- If "%check%"=="0" set odivide=%divisor%
- If "%check%"=="1" (set /a nintenger=%numerator%/%divisor%
- ) else (
- set /a integer=%numerator%/%divisor%
- )
- If "%check%"=="1" (
- set /a remainder=%numerator%-(%ninteger%*%divisor%)
- ) else (
- set /a remainder=%numerator%-(%integer%*%divisor%)
- )
- If "%check%"=="1" (
- set /a nfloat=(%remainder%*100)/%divisor%
- ) else (
- set /a float=(%remainder%*100)/%divisor%
- )
- If "%check%"=="1" (set newfloat=%ninteger%.%nfloat%
- ) else (
- set result=%integer%.%float%
- )
- goto newfloat
- :newfloat
- If "%check%"=="1" goto check
- echo %result%
- Set x=%result%
- Set y=%divisor%
- Set sign=*
- Set check=1
- Goto blergle
- :check
- If "%newfloat%"=="%numerator%" echo %result% & goto input
- Set ad=%add%0
- Set result=%integer%.%ad%%float%
- Set x=%result%
- Set y=%odivide%
- Goto blergle
Advertisement
Add Comment
Please, Sign In to add comment