Tuesday, 16 June 2020

Basic Calculator in CMD

  • Start notepad on your system
  • Paste the following code:
  • @echo off
    cd c:\windows\system32
    title CALCULATOR
    echo Enter a to add, s to substract, d to divide and m to multiply
    set /p ch=:
    If %ch% == a goto a
    If %ch% == s goto s
    If %ch% == d goto d
    If %ch% == m goto m
    :a
    set /p o=First Number: 
    set /p t=Second Number: 
    set /a a=%o% 
    set /a b=%t% 
    set /a ans = %a%+%b% 
    echo %ans% 
    goto end
    :s
    set /p o=First Number: 
    set /a a=%o% 
    set /p t=Second Number: 
    set /a b=%t%
    set /a ans = %a%-%b% 
    echo %ans% 
    goto end
    :d 
    set /p o=First Number: 
    set /a a=%o% 
    set /p t=Second Number: 
    set /a b=%t%
    set /a ans = %a%/%b% 
    echo %ans% 
    goto end
    :m
    set /p o=First Number: 
    set /a a=%o% 
    set /p t=Second Number: 
    set /a b=%t%
    set /a ans = %a%*%b% 
    echo %ans% 
    goto end
    :end
    pause
  • Save the notepad file as Calc.cmd on desktop
  • Just double-click the file to start the Calculator

1 comment:

Algorithmic Pixel Art: The Beauty of Aliasing

Discussed  here More images in  Google drive Some outputs: Forward to anyone who says aliasing is ugly.