Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- if "%1"=="/?" goto :help
- setlocal
- if "%1"=="" (
- goto :readEq
- ) else (
- goto :main
- )
- :readEq
- echo Type the equation, please
- rem READ
- :main
- set varvar=
- :loop
- if "%1"=="" goto :solve
- set varvar=%varvar%%1
- shift
- goto :loop
- :solve
- set /a res=%varvar% 2>nul
- if %errorlevel%==0 (
- echo Result = %res%
- ) else (
- echo Incorrect Equation
- )
- goto :eof
- :help
- echo Simple calculator
- echo Type an equation and calculator will print the answer
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement