Breaking

Sunday, 23 June 2013

How to Program A Calculator With Notepad (Batch Tut)

For those of my readers who are quite interested in programming stuff, here is a little Batch tutorial to help you program a simple calculator in the .bat format. It won’t take you more than 5 minutes and your first calculator that can perform all basic calculation functions would be live.

How to Make a Simple Calculator in Notepad using .bat format

  • Launch your Notepad from your Windows OS PC.
  • Copy and paste this code below into it
    @echo off
    title Batch Calculator by (your name)
    color 0c
    :top
    echo ————————————–
    echo -Welcome to Batch Calculator by *(your name)!-
    echo ————————————–
    echo Enter your operand
    echo.
    set /p sum=
    set /a ans=%sum%
    echo.
    echo = %ans%
    echo ————————————————————–
    pause
    cls
    echo Previous Answer: %ans%
    goto top
    pause
    exit
  • Now press CTRL + S to save, in the file name put in Calc.bat
  • In the File type, select All Files then Click on Save.
  • Now Launch the Calc.bat by double clicking on it.
Your Calculator is live, you can make use of it to perform your basic calculation functions.

No comments:

Post a Comment