Advertisement
Um_nik

Untitled

Oct 15th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. @echo off
  2.  
  3. if "%1"=="/?" goto :help
  4.  
  5. setlocal
  6.  
  7. if "%1"=="" (
  8. goto :readEq
  9. ) else (
  10. goto :main
  11. )
  12.  
  13.  
  14. :readEq
  15. echo Type the equation, please
  16. rem READ
  17.  
  18. :main
  19.  
  20. set varvar=
  21.  
  22. :loop
  23. if "%1"=="" goto :solve
  24. set varvar=%varvar%%1
  25. shift
  26. goto :loop
  27.  
  28. :solve
  29. set /a res=%varvar% 2>nul
  30. if %errorlevel%==0 (
  31. echo Result = %res%
  32. ) else (
  33. echo Incorrect Equation
  34. )
  35.  
  36. goto :eof
  37.  
  38. :help
  39. echo Simple calculator
  40. echo Type an equation and calculator will print the answer
  41. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement