Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- mode 70,40
- color 0f
- title Calculator by GL1TCH3D
- set a=0
- set x=0
- set blehs=0
- for /l %%E in (1,1,9) do (
- set ans%%E=0
- set answer%%E=0
- )
- setlocal enabledelayedexpansion
- :top
- cls
- echo Type "help" for more information.
- echo Type "functions" to input functions.
- echo.
- echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- echo º Index of Symbols: º
- echo º * = Multiplication º
- echo º + = Addition º
- echo º - = Subtration º
- echo º / = Division º
- echo º : = Exponent º
- echo º $ = Factoral º
- echo º E = *10^^# º
- echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
- set /a a+=1
- set /p UDefine=
- if /i "%UDefine%"=="functions" (
- set /a a-=1
- goto functions
- )
- if /i "%UDefine%"=="exponent" goto exponent
- if /i "%UDefine%"=="e" goto exponent
- if /i "%UDefine%"=="factoral" goto factoral
- if /i "%UDefine%"=="f" goto factoral
- if /i "%UDefine%"=="help" goto help
- set /a answer%a%=%UDefine%
- if %a%==9 goto ans
- set ans%a%=%UDefine%=!answer%a%!
- goto top
- :ans
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=%UDefine%=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto top
- :exponent
- echo You'll be prompted 2 times.
- echo One for the base and a second for the power.
- echo The minimum power is 0.
- echo To exit exponent mode, type "top" as the base.
- set /p base=Base:
- set /p power=Power:
- if %base%==top goto top
- if %power% LSS 0 (
- echo Invalid power
- ping -n 3 localhost > nul
- cls
- goto exponent
- )
- set answer%a%=1
- set c=0
- :loop
- if %c%==%power% goto next
- set /a answer%a%*=%base%
- set /a c+=1
- goto loop
- :next
- if %a%==9 goto anse
- set ans%a%=%base%:%power%=!answer%a%!
- goto top
- :anse
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=%base%:%power%=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto top
- :factoral
- echo Just type the number you'd like to take the factoral of.
- echo The number must be greater than or equal to zero (0)
- set /p fact=
- if %fact% lss 0 (
- cls
- goto factoral
- )
- set facter=%fact%
- set answer%a%=1
- :fact1
- if %facter%==1 goto nextfact
- set /a answer%a%*=%facter%
- set /a facter-=1
- goto fact1
- :nextfact
- if %a%==9 goto ansef
- set ans%a%=%fact%$=!answer%a%!
- goto top
- :ansef
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=%fact%$=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto top
- :help
- setlocal disabledelayedexpansion
- echo Just type the equation you'd like to see done.
- echo You can also use "!answer#!" to use a given answer.
- echo The # sign represents a number of your choice from one of the lines.
- echo To use an exponent, type "exponent" or "e".
- echo To use factorals, type "factoral" or "f".
- echo.
- echo PLEASE KEEP IN MIND: Batch always rounds down. 3/2 will give you 1.
- echo Therefore, it may not be worthwhile to use this for division...
- echo To keep things simple, I didn't bother with certain functions for obvious reasons.
- pause
- setlocal enabledelayedexpansion
- set /a a-=1
- goto top
- :functions
- cls
- echo Welcome to the functions section.
- echo Here you will be able to define single variable functions.
- echo Keep in mind, batch always rounds down.
- echo Example: F(x)=x/2. If x=1, f(x)=1/2 but batch will calculate 0.
- echo You'll have to choose the type of function you want to input before.
- echo You can also type "top" to return to the top.
- echo For the moment, all functions must be entered in "simplified" form.
- echo Example: f(x)=4(x+2)(squared) +3
- :menuf
- echo.
- echo These are your options:
- echo 1) Polynomial (F(x)=(a(x-h)^^e)+k)
- echo 2) Absolute Value (G(x)=a^|x-h^|+k)
- echo 3) Rational (H(x)=(a/(x-h))+k)
- echo 4) Linear (I(x)=ax+b)
- set /p optionf=
- if %optionf%==1 goto polynomial
- if %optionf%==2 goto absolute
- if %optionf%==3 goto rational
- if %optionf%==4 goto linear
- if %optionf%==top goto top
- echo Invalid option, try again.
- ping -n 3 localhost > nul
- cls
- goto menuf
- :polynomial
- cls
- echo Polynomials in simple form are of the following:
- echo F(x)=r(x-h)^^e +k
- echo where r is the rate of change.
- echo where h,k is the vertex
- echo and where e is the power of which the function is raised.
- echo a should not be zero (0) and e should be greater than zero (0).
- set /p r=Value for r:
- set /p h=Value for h:
- set /p e=Value for e:
- set /p k=Value for k:
- :checkpoly
- if %r%==0 (
- set /p a=Please enter a new value for r:
- goto checkpoly
- )
- if not %e% GTR 0 (
- set /p e=Please enter a new value for e:
- goto checkpoly
- )
- :askcorrectfp
- echo Is this correct? F(x)=%r%(x-%h%)^^%e% +%k%
- set /p askfp=(Y/N)
- if %askfp%==n goto functions
- :continuefp
- cls
- echo Type "top" to go to top
- echo Type "f" to change functions
- echo.
- echo F(x)=%r%(x-%h%)^^%e% +%k%
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- set /p x=What would you like to set x as?
- if /i %x%==top goto top
- if /i %x%==f goto functions
- set /a a+=1
- set /a base=(%x%-%h%)
- set answer%a%=1
- set c=0
- :loopfp
- if %c%==%e% goto nextfp
- set /a answer%a%*=%base%
- set /a c+=1
- goto loopfp
- :nextfp
- set /a answer%a%=(%r%*!answer%a%!)+%k%
- if %a%==9 goto ansefp
- set ans%a%=F(%x%)=!answer%a%!
- goto continuefp
- :ansefp
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=F(%x%)=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto continuefp
- :absolute
- cls
- echo Absolutes in simple form are of the following:
- echo G(x)=r^|x-h^|+k
- echo where r is the rate of change.
- echo where h,k is the vertex
- echo a should not be zero (0).
- set /p r=Value for r:
- set /p h=Value for h:
- set /p k=Value for k:
- :checkabso
- if %r%==0 (
- set /p r=Please enter a new value for r:
- goto checkabso
- )
- :askcorrectfa
- echo Is this correct? G(x)=%r%^|x-%h%^|+%k%
- set /p askfa=(Y/N)
- if %askfa%==n goto functions
- :continuefa
- cls
- echo Type "top" to go to top
- echo Type "f" to change functions
- echo.
- echo G(x)=%r%^|x-%h%^|+%k%
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- set /p x=What would you like to set x as?
- if /i %x%==top goto top
- if /i %x%==f goto functions
- set /a a+=1
- set /a base=(%x%-%h%)
- set answer%a%=1
- if %base% LSS 0 set /a base*=-1
- set /a answer%a%*=%base%
- set /a answer%a%=(%r%*!answer%a%!)+%k%
- if %a%==9 goto ansefa
- set ans%a%=G(%x%)=!answer%a%!
- goto continuefa
- :ansefa
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=G(%x%)=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto continuefa
- :rational
- cls
- echo Rationals in simple form are of the following:
- echo H(x)=(r/x-h)+k
- echo where r is the rate of change.
- echo where h is the horizontal asymptote.
- echo and k is the vertical asymptote.
- echo a should not be zero (0).
- set /p r=Value for r:
- set /p h=Value for h:
- set /p k=Value for k:
- :checkrati
- if %r%==0 (
- set /p r=Please enter a new value for r:
- goto checkrati
- )
- :askcorrectfr
- echo Is this correct? H(x)=(%r%/x-%h%)+%k%
- set /p askfr=(Y/N)
- if %askfr%==n goto functions
- :continuefr
- cls
- echo Type "top" to go to top
- echo Type "f" to change functions
- echo.
- echo H(x)=(%r%/%x%-%h%)+%k%
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- set /p x=What would you like to set x as?
- if /i %x%==top goto top
- if /i %x%==f goto functions
- set /a a+=1
- set /a base=(%x%-%h%)
- set answer%a%=%r%
- set /a answer%a%/=%base%
- set /a answer%a%=!answer%a%!+%k%
- if %af%==9 goto ansefr
- set ans%a%=H(%x%)=!answer%a%!
- goto continuefr
- :ansefr
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=H(%x%)=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto continuefr
- :linear
- cls
- echo Linear in simple form are of the following:
- echo I(x)=rx+b
- echo where r is the rate of change.
- echo where b is the y-intercept.
- echo a should not be zero (0).
- set /p r=Value for r:
- set /p b=Value for b:
- :checkline
- if %r%==0 (
- set /p r=Please enter a new value for r:
- goto checkabso
- )
- :askcorrectfl
- echo Is this correct? I(x)=%r%x+%b%
- set /p askfl=(Y/N)
- if %askfl%==n goto functions
- :continuefl
- cls
- echo Type "top" to go to top
- echo Type "f" to change functions
- echo.
- echo I(x)=%r%x+%b%
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- set /p x=What would you like to set x as?
- if /i %x%==top goto top
- if /i %x%==f goto functions
- set /a a+=1
- set /a answer%a%=(%r%*%x%)+%b%
- if %a%==9 goto ansefl
- set ans%a%=I(%x%)=!answer%a%!
- goto continuefl
- :ansefl
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=I(%x%)=!answer%a%!
- set answer1=%answer2%
- set answer2=%answer3%
- set answer3=%answer4%
- set answer4=%answer5%
- set answer5=%answer6%
- set answer6=%answer7%
- set answer7=%answer8%
- set a=8
- goto continuefl
Advertisement
Add Comment
Please, Sign In to add comment