Advertisement
BlueberryBots

Working Calculator

May 30th, 2020
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.65 KB | None | 0 0
  1. @echo off
  2. color 0A
  3.  
  4.  
  5. :startup
  6. goto input1
  7.  
  8.  
  9. :preinput1
  10. cls
  11. echo.
  12. echo PREVIOUS ANSWER:
  13. echo %output%
  14.  
  15.  
  16. :input1
  17. echo.
  18. echo Insert starting number:
  19. echo.
  20. set /p number1=
  21. goto operation
  22.  
  23.  
  24. :operation
  25. echo.
  26. echo (b) to go back
  27. echo.
  28. echo (a) for addition
  29. echo (s) for subtraction
  30. echo (m) for multiplication
  31. echo (d) for division
  32. echo.
  33. set /p operationchoice=
  34.  
  35.     if %operationchoice% == a goto addinput2
  36.     if %operationchoice% == s goto subinput2
  37.     if %operationchoice% == m goto mulinput2
  38.     if %operationchoice% == d goto divinput2
  39.     if %operationchoice% == b goto input1
  40.         goto operation
  41.  
  42.  
  43.  
  44. :addinput2
  45. echo.
  46. echo (b) to go back
  47. echo.
  48. echo Insert second number:
  49. echo.
  50. set /p number2=
  51.  
  52.     if %number2% == b goto operation
  53.  
  54. goto add
  55.  
  56.  
  57. :subinput2
  58. echo.
  59. echo (b) to go back
  60. echo.
  61. echo Insert second number:
  62. echo.
  63. set /p number2=
  64.  
  65.     if %number2% == b goto operation
  66.  
  67. goto sub
  68.  
  69.  
  70. :mulinput2
  71. echo.
  72. echo (b) to go back
  73. echo.
  74. echo Insert second number:
  75. echo.
  76. set /p number2=
  77.  
  78.     if %number2% == b goto operation
  79.  
  80. goto mul
  81.  
  82.  
  83. :divinput2
  84. echo.
  85. echo (b) to go back
  86. echo.
  87. echo Insert second number:
  88. echo.
  89. set /p number2=
  90.  
  91.     if %number2% == b goto operation
  92.  
  93. goto div
  94.  
  95.  
  96. :add
  97. set /a output = %number1% + %number2%
  98. echo.
  99. echo ANSWER:
  100. echo %output%
  101. echo.
  102. pause
  103. goto preinput1
  104.  
  105.  
  106. :sub
  107. set /a output = %number1% - %number2%
  108. echo.
  109. echo ANSWER:
  110. echo %output%
  111. echo.
  112. pause
  113. goto preinput1
  114.  
  115.  
  116. :mul
  117. set /a output = %number1% * %number2%
  118. echo.
  119. echo ANSWER:
  120. echo %output%
  121. echo.
  122. pause
  123. goto preinput1
  124.  
  125.  
  126. :div
  127. set /a output = %number1% / %number2%
  128. echo.
  129. echo ANSWER:
  130. echo %output%
  131. echo.
  132. pause
  133. goto preinput1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement