Introduction: Batch Calculator Advenced

Picture of Batch Calculator Advenced

I made a batch Calculator

I hope you can learn a thing from it. If you have any questions please comment below.

I prefer notepad ++ because it recognizes the code.

I updated it so it can use the previous answer in the next sum. And now it has a brighter white color 0F

Here is my code:

@echo off
title Batch Calculator by ICTrix

color 0F

:menu

cls

echo --------------------------------------------------------------

echo Welcome to Batch Calculator by ICTrix

echo -------------------------------------------------------------- echo.

echo Choose what you want to do

echo 1) Go to Legenda

echo 2) Enter Sum

echo 3) Go to credits

echo.

set /p f= Choice:

if "%f%" == "1" goto legenda

if "%f%" == "2" goto sum

if "%f%" == "3" start https://www.instructables.com/id/Batch-Calculator-...

goto menu

:legenda

cls

echo Legenda:

echo divided by = /

echo times = *

echo plus = +

echo minus = -

echo.

echo Choose what you want to do

echo 1) Return to Main menu

echo 2) Enter sum

echo 3) Exit

echo.

set /p p= Choice:

if "%p%" == "1" goto menu

if "%p%" == "2" goto sum

if "%p%" == "3" exit

goto legenda

:sum

cls

echo Please enter sum

echo.

set /p sum= Sum:

set /a ans= %sum%

echo.

:answer

cls

echo %sum%=%ans%

echo --------------------------------------------------------------

echo Choose what you want to do

echo 1) Return to Main menu

echo 2) Exit

echo 3) Other sum

echo 4) Use answer in next sum

set /p choice= Choice:

if %choice%==1 goto menu

if %choice%==2 exit

if %choice%==3 goto sum

if %choice%==4 goto sum2

goto answer

:sum2

cls

echo Answer=%ans%

echo ----------------------------------------------------------------

echo Choose what you want to do with the answer

echo.

set /p sum= Sum:

set /a ans2= %sum%+%ans%

echo.

:answer2

cls

echo %ans%%sum%=%ans2%

echo --------------------------------------------------------------

echo Choose what you want to do

echo 1) Return to Main menu

echo 2) Exit

echo 3) Other sum

echo 4) Use answer in next sum

set /p choice= Choice:

if %choice%==1 goto menu

if %choice%==2 exit

if %choice%==3 goto sum

if %choice%==4 goto sum3

goto answer2

:sum3

cls

echo Answer=%ans2%

echo ----------------------------------------------------------------

echo Choose what you want to do with the answer

echo.

set /p sum= Sum:

set /a ans3= %sum%+%ans2%

echo.

:answer3

cls

echo %ans2%%sum%=%ans3%

echo --------------------------------------------------------------

echo Choose what you want to do

echo 1) Return to Main menu

echo 2) Exit

echo 3) Other sum

echo 4) Use answer in next sum

set /p choice= Choice:

if %choice%==1 goto menu

if %choice%==2 exit

if %choice%==3 goto sum

if %choice%==4 goto sum4

goto answer3

:sum4

cls

echo Answer=%ans3%

echo ----------------------------------------------------------------

echo Choose what you want to do with the answer

echo.

set /p sum= Sum:

set /a ans4= %sum%+%ans3%

echo.

:answer4

cls

echo %ans3%%sum%=%ans4%

echo --------------------------------------------------------------

echo Choose what you want to do

echo 1) Return to Main menu

echo 2) Exit

echo 3) Other sum

set /p choice= Choice:

if %choice%==1 goto menu

if %choice%==2 exit

if %choice%==3 goto sum

goto answer4

Comments

kxmposing (author)2017-03-03

Hi ICTrix,

I made a simple calculator that cannot calculate exponents, etc.

Can you put all the commands together so that I would have an advanced calculator? So that I would be able to calculate exponents, Stuff like 3^4= ... and and so on...

I am not that good in batch scripting and I don't know how to add those stuff :(

Here is my code:

@echo off

:start

set /p MATH=Equation?

set /a RESULT=%MATH%

echo %RESULT%

pause

cls

goto start

DIY Hacks and How Tos (author)2016-12-03

Great introduction to batch programming.

Thnx I appreciate it!

ICTrix (author)2016-12-11

I hope you like the update!

About This Instructable

193views

3favorites

License:

More by ICTrix:Batch calculator Advenced
Add instructable to: