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 graph=0
- 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 Type "options" to change settings.
- echo.
- echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- echo º Index of Symbols: º
- echo º * = Multiplication º
- echo º + = Addition º
- echo º - = Subtration º
- echo º / = Division º
- echo º : = Exponent º
- echo º $ = Factoral º
- echo º E = *10^^# º
- echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- call :echoans
- echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
- set /a a+=1
- set /p UDefine=
- if /i "%UDefine%"=="functions" (
- set /a a-=1
- goto functions
- )
- if /i "%UDefine%"=="options" goto options
- if /i "%UDefine%"=="o" goto options
- 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
- if /i "%UDefine%"=="h" goto help
- set /a answer%a%=%UDefine%
- if %a%==9 call :shiftans %UDefine% top
- set ans%a%=%UDefine%=!answer%a%!
- 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 call :shiftans %base%:%power% top
- set ans%a%=%base%:%power%=!answer%a%!
- 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 call :shiftans %fact%$ top
- set ans%a%=%fact%$=!answer%a%!
- 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%
- call :echoans
- 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 call :shiftans F(%x%) continuefp
- set ans%a%=F(%x%)=!answer%a%!
- 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%
- call :echoans
- 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 call :shiftans G(%x%) continuefa
- set ans%a%=G(%x%)=!answer%a%!
- 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%
- call :echoans
- 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 %a%==9 call :shiftans H(%x%) continuefr
- set ans%a%=H(%x%)=!answer%a%!
- 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%
- call :echoans
- 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 call :shiftans I(%x%) continuefl
- set ans%a%=I(%x%)=!answer%a%!
- goto continuefl
- :options
- cls
- echo 1) Graph options
- set /p opt1=What options menu would you like to go to? (Enter top to go back)
- if /i "%opt1%"=="top" goto top
- if "%opt1%"=="1" goto graphopt
- echo Invalid input, returning to main menu.
- ping -n 2 localhost > nul
- goto top
- :graphopt
- cls
- echo 1) Enable/disable graphs (beta)
- echo 2) Change graph size
- echo 3) Test graph
- set /p graphopt1=What options menu would you like to go to? (Enter top to go back)
- if "%graphopt1%"=="top" goto top
- if "%graphopt1%"=="1" goto enablegraph
- if "%graphopt1%"=="2" goto graphsize
- if "%graphopt1%"=="3" goto testgraph
- echo Invalid input. Please try again.
- ping -n 2 localhost > nul
- goto graphopt
- :enablegraph
- echo Graphing for functions allows the points to be plotted on a basic graph.
- echo This is currently in beta and only works on functions, factoral and exponent calculations.
- echo (Please keep in mind that the size of the graph limits the possible points plotted)
- echo (Increase the size of the graph if you plan on plotting data sets with larger values)
- set /p graphs=Enter 1 to enable graphs or 0 to disable graphs.
- if "%graphs%"=="1" set graph=1
- goto top
- :graphsize
- echo Enter "top" to go back to the main menu.
- Enter "d" or "default" to return both values to default and go to top.
- set /p uz=Enter the x extension for the function graphs:
- if /i "%uz%"=="top" goto top
- if /i "%uz%"=="default" set y=10&set z=10&goto top
- set z=%uz%
- echo X extension value saved.
- echo.
- set /p uy=Enter the y extension for the function graphs:
- if /i "%uy%"=="top" goto top
- if /i "%uy%"=="default" set y=10&set z=10&goto top
- echo y extension value saved.
- ping -n 3 localhost > nul
- goto top
- :testgraph
- cls
- echo Enter the points you wish to push to the graph in the form "x,y" (without the quotes)
- echo Press space and enter to stop the input of coordinates.
- echo.
- set /p p1=Enter point 1:
- if "%p1%"==" " call :graph "%z%,%y%"
- set /p p2=Enter point 2:
- if "%p2%"==" " call :graph "%z%,%y%" "%p1%"
- set /p p3=Enter point 3:
- if "%p1%"==" " call :graph "%z%,%y%" "%p1%" "%p2%"
- set /p p4=Enter point 4:
- if "%p1%"==" " call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%"
- set /p p5=Enter point 5:
- if "%p1%"==" " call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%" "%p4%"
- set /p p6=Enter point 6:
- if "%p1%"==" " call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%" "%p4%" "%p5%"
- set /p p7=Enter point 7:
- if "%p1%"==" " call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%" "%p4%" "%p5%" "%p6%"
- set /p p8=Enter point 8:
- if "%p1%"==" " (
- call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%" "%p4%" "%p5%" "%p6%" "%p7%"
- ) else (
- call :graph "%z%,%y%" "%p1%" "%p2%" "%p3%" "%p4%" "%p5%" "%p6%" "%p7%" "%p8%"
- pause > nul
- :echoans
- echo 1) %ans1%
- echo 2) %ans2%
- echo 3) %ans3%
- echo 4) %ans4%
- echo 5) %ans5%
- echo 6) %ans6%
- echo 7) %ans7%
- echo 8) %ans8%
- exit /b
- :shiftans
- set ans1=%ans2%
- set ans2=%ans3%
- set ans3=%ans4%
- set ans4=%ans5%
- set ans5=%ans6%
- set ans6=%ans7%
- set ans7=%ans8%
- set ans8=%1=!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 %2
- :graph
- set t1=(%~2)
- set t2=(%~3)
- set t3=(%~4)
- set t4=(%~5)
- set t5=(%~6)
- set t6=(%~7)
- set t7=(%~8)
- set t8=(%~9)
- echo %1
- set z=%~1
- echo %z%
- set z=%z:~0,1%
- set y=%~1
- echo %y%
- set y=%y:~2,1%
- echo %z% %y%
- pause
- set /a x2=%z%*2+1
- set /a x3=%x2%-%z%
- set /a x4=(%z%+5)*2
- set /a y4=(%y%+5)*2
- set /a y2=%y%*2+1
- set /a y3=%y2%-%y%
- ::echo values for check
- for /l %%a in (1,1,8) do echo !t%%a!
- pause
- ::end echo
- mode %x4%,%y4%
- :setvars
- for /l %%a in (1,1,%x2%) do (
- for /l %%b in (%y2%,-1,1) do (
- set %%a,%%b=
- if "%%a"=="%x3%" set %%a,%%b=Ã
- )
- set (%%a,%y3%)=Á
- )
- set (%x3%,%y3%)=Î
- :prebuild
- set b=%y2%
- :builder
- set c=1
- :loop
- set ly%b%=!ly%b%!!(%c%,%b%)!
- if "%c%"=="%x2%" goto next
- set /a c+=1
- goto loop
- :next
- if %b%==1 goto nextnext&set s=1
- set /a b-=1
- goto builder
- :nextnext
- if "!t%s%!"=="" goto echograph
- set /a changex=%x3%+!t%s%:~0,1!
- set /a changey=%y3%+!t%s%:~2,1!
- set (%changex%,%changey%)=%s%
- set /a s+=1
- goto nextnext
- :echograph
- for /l %%d in (%y2%,-1,1) do (
- echo !ly%%d!
- )
- for /l %%e in (1,1,%y2%) do set ly%%e=
- goto testgraph
Advertisement
Add Comment
Please, Sign In to add comment