BATCH Calculator

Page 1 of 1

0 Replies - 1305 Views - Last Post: 08 December 2009 - 07:59 AM

#1 VulcanDesign

Reputation: 6
• Posts: 98
• Joined: 06-December 09

BATCH Calculator

Posted 08 December 2009 - 07:59 AM

Description: Simply copy the code to a program like Notepad, and save as yourname.batThis is the code for a simple calculator capable of doing addition, subtraction, multiplication, and division. It also has a very simple user interface. It is written in BATCH.
```@echo off
title Simple Calculator
echo Welcome to this Simple Calculator. With this calculator, you can preform basic addition, subtraction, division, and multiplication.
pause
cls
:start
echo -----
echo Simple Calculator
echo ....................
echo Please preform one of the following functions:
echo .
echo 1: Clear calculator
echo 3: Subtraction
echo 4: Multiplication
echo 5: Division
echo 6: Exit program
if %choice% EQU 1 goto :clear
if %choice% EQU 2 goto :addition
if %choice% EQU 3 goto :subtraction
if %choice% EQU 4 goto :multiplication
if %choice% EQU 5 goto :division
if %choice% EQU 6 goto :exit
cls
goto :start

:clear
cls
goto :start

cls
echo .
set /p num1=Number:
echo +
set /p num2=Number:
set /a ans=%num1%+%num2%
echo %num1% + %num2% = %ans%
pause
goto :start

:subtraction
cls
echo SUBTRACTION
echo .
set /p num1=Number:
echo -
set /p num2=Number:
set /a ans=%num1%-%num2%
echo %num1% - %num2% = %ans%
pause
goto :start

:multiplication
cls
echo MULTIPLICATION
echo .
set /p num1=Number:
echo X
set /p num2=Number:
set /a ans=%num1%*%num2%
echo %num1% x %num2% = %ans%
pause
goto :start

:division
cls
echo DIVISION
echo .
set /p num1=Number:
echo /
set /p num2=Number:
set /a ans=%num1%/%num2%
echo %num1%/%num2% = %ans%
pause
goto :start

:exit
echo Thank you for using Simple Calculator
pause
:eof
```

Is This A Good Question/Topic? 1

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }