GL1TCH3D

Super Batch Calculator

Oct 16th, 2011
2,180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.14 KB | None | 0 0
  1. @echo off
  2. mode 70,40
  3. color 0f
  4. title Calculator by GL1TCH3D
  5. set a=0
  6. set x=0
  7. set blehs=0
  8. for /l %%E in (1,1,9) do (
  9. set ans%%E=0
  10. set answer%%E=0
  11. )
  12. setlocal enabledelayedexpansion
  13. :top
  14. cls
  15. echo Type "help" for more information.
  16. echo Type "functions" to input functions.
  17. echo.
  18. echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  19. echo º Index of Symbols: º
  20. echo º * = Multiplication º
  21. echo º + = Addition º
  22. echo º - = Subtration º
  23. echo º / = Division º
  24. echo º : = Exponent º
  25. echo º $ = Factoral º
  26. echo º E = *10^^# º
  27. echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  28. echo 1) %ans1%
  29. echo 2) %ans2%
  30. echo 3) %ans3%
  31. echo 4) %ans4%
  32. echo 5) %ans5%
  33. echo 6) %ans6%
  34. echo 7) %ans7%
  35. echo 8) %ans8%
  36. echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
  37. set /a a+=1
  38. set /p UDefine=
  39. if /i "%UDefine%"=="functions" (
  40. set /a a-=1
  41. goto functions
  42. )
  43. if /i "%UDefine%"=="exponent" goto exponent
  44. if /i "%UDefine%"=="e" goto exponent
  45. if /i "%UDefine%"=="factoral" goto factoral
  46. if /i "%UDefine%"=="f" goto factoral
  47. if /i "%UDefine%"=="help" goto help
  48. set /a answer%a%=%UDefine%
  49. if %a%==9 goto ans
  50. set ans%a%=%UDefine%=!answer%a%!
  51. goto top
  52. :ans
  53. set ans1=%ans2%
  54. set ans2=%ans3%
  55. set ans3=%ans4%
  56. set ans4=%ans5%
  57. set ans5=%ans6%
  58. set ans6=%ans7%
  59. set ans7=%ans8%
  60. set ans8=%UDefine%=!answer%a%!
  61. set answer1=%answer2%
  62. set answer2=%answer3%
  63. set answer3=%answer4%
  64. set answer4=%answer5%
  65. set answer5=%answer6%
  66. set answer6=%answer7%
  67. set answer7=%answer8%
  68. set a=8
  69. goto top
  70. :exponent
  71. echo You'll be prompted 2 times.
  72. echo One for the base and a second for the power.
  73. echo The minimum power is 0.
  74. echo To exit exponent mode, type "top" as the base.
  75. set /p base=Base:
  76. set /p power=Power:
  77. if %base%==top goto top
  78. if %power% LSS 0 (
  79. echo Invalid power
  80. ping -n 3 localhost > nul
  81. cls
  82. goto exponent
  83. )
  84. set answer%a%=1
  85. set c=0
  86. :loop
  87. if %c%==%power% goto next
  88. set /a answer%a%*=%base%
  89. set /a c+=1
  90. goto loop
  91. :next
  92. if %a%==9 goto anse
  93. set ans%a%=%base%:%power%=!answer%a%!
  94. goto top
  95. :anse
  96. set ans1=%ans2%
  97. set ans2=%ans3%
  98. set ans3=%ans4%
  99. set ans4=%ans5%
  100. set ans5=%ans6%
  101. set ans6=%ans7%
  102. set ans7=%ans8%
  103. set ans8=%base%:%power%=!answer%a%!
  104. set answer1=%answer2%
  105. set answer2=%answer3%
  106. set answer3=%answer4%
  107. set answer4=%answer5%
  108. set answer5=%answer6%
  109. set answer6=%answer7%
  110. set answer7=%answer8%
  111. set a=8
  112. goto top
  113. :factoral
  114. echo Just type the number you'd like to take the factoral of.
  115. echo The number must be greater than or equal to zero (0)
  116. set /p fact=
  117. if %fact% lss 0 (
  118. cls
  119. goto factoral
  120. )
  121. set facter=%fact%
  122. set answer%a%=1
  123. :fact1
  124. if %facter%==1 goto nextfact
  125. set /a answer%a%*=%facter%
  126. set /a facter-=1
  127. goto fact1
  128. :nextfact
  129. if %a%==9 goto ansef
  130. set ans%a%=%fact%$=!answer%a%!
  131. goto top
  132. :ansef
  133. set ans1=%ans2%
  134. set ans2=%ans3%
  135. set ans3=%ans4%
  136. set ans4=%ans5%
  137. set ans5=%ans6%
  138. set ans6=%ans7%
  139. set ans7=%ans8%
  140. set ans8=%fact%$=!answer%a%!
  141. set answer1=%answer2%
  142. set answer2=%answer3%
  143. set answer3=%answer4%
  144. set answer4=%answer5%
  145. set answer5=%answer6%
  146. set answer6=%answer7%
  147. set answer7=%answer8%
  148. set a=8
  149. goto top
  150. :help
  151. setlocal disabledelayedexpansion
  152. echo Just type the equation you'd like to see done.
  153. echo You can also use "!answer#!" to use a given answer.
  154. echo The # sign represents a number of your choice from one of the lines.
  155. echo To use an exponent, type "exponent" or "e".
  156. echo To use factorals, type "factoral" or "f".
  157. echo.
  158. echo PLEASE KEEP IN MIND: Batch always rounds down. 3/2 will give you 1.
  159. echo Therefore, it may not be worthwhile to use this for division...
  160. echo To keep things simple, I didn't bother with certain functions for obvious reasons.
  161. pause
  162. setlocal enabledelayedexpansion
  163. set /a a-=1
  164. goto top
  165. :functions
  166. cls
  167. echo Welcome to the functions section.
  168. echo Here you will be able to define single variable functions.
  169. echo Keep in mind, batch always rounds down.
  170. echo Example: F(x)=x/2. If x=1, f(x)=1/2 but batch will calculate 0.
  171. echo You'll have to choose the type of function you want to input before.
  172. echo You can also type "top" to return to the top.
  173. echo For the moment, all functions must be entered in "simplified" form.
  174. echo Example: f(x)=4(x+2)(squared) +3
  175. :menuf
  176. echo.
  177. echo These are your options:
  178. echo 1) Polynomial (F(x)=(a(x-h)^^e)+k)
  179. echo 2) Absolute Value (G(x)=a^|x-h^|+k)
  180. echo 3) Rational (H(x)=(a/(x-h))+k)
  181. echo 4) Linear (I(x)=ax+b)
  182. set /p optionf=
  183. if %optionf%==1 goto polynomial
  184. if %optionf%==2 goto absolute
  185. if %optionf%==3 goto rational
  186. if %optionf%==4 goto linear
  187. if %optionf%==top goto top
  188. echo Invalid option, try again.
  189. ping -n 3 localhost > nul
  190. cls
  191. goto menuf
  192. :polynomial
  193. cls
  194. echo Polynomials in simple form are of the following:
  195. echo F(x)=r(x-h)^^e +k
  196. echo where r is the rate of change.
  197. echo where h,k is the vertex
  198. echo and where e is the power of which the function is raised.
  199. echo a should not be zero (0) and e should be greater than zero (0).
  200. set /p r=Value for r:
  201. set /p h=Value for h:
  202. set /p e=Value for e:
  203. set /p k=Value for k:
  204. :checkpoly
  205. if %r%==0 (
  206. set /p a=Please enter a new value for r:
  207. goto checkpoly
  208. )
  209. if not %e% GTR 0 (
  210. set /p e=Please enter a new value for e:
  211. goto checkpoly
  212. )
  213. :askcorrectfp
  214. echo Is this correct? F(x)=%r%(x-%h%)^^%e% +%k%
  215. set /p askfp=(Y/N)
  216. if %askfp%==n goto functions
  217. :continuefp
  218. cls
  219. echo Type "top" to go to top
  220. echo Type "f" to change functions
  221. echo.
  222. echo F(x)=%r%(x-%h%)^^%e% +%k%
  223. echo 1) %ans1%
  224. echo 2) %ans2%
  225. echo 3) %ans3%
  226. echo 4) %ans4%
  227. echo 5) %ans5%
  228. echo 6) %ans6%
  229. echo 7) %ans7%
  230. echo 8) %ans8%
  231. set /p x=What would you like to set x as?
  232. if /i %x%==top goto top
  233. if /i %x%==f goto functions
  234. set /a a+=1
  235. set /a base=(%x%-%h%)
  236. set answer%a%=1
  237. set c=0
  238. :loopfp
  239. if %c%==%e% goto nextfp
  240. set /a answer%a%*=%base%
  241. set /a c+=1
  242. goto loopfp
  243. :nextfp
  244. set /a answer%a%=(%r%*!answer%a%!)+%k%
  245. if %a%==9 goto ansefp
  246. set ans%a%=F(%x%)=!answer%a%!
  247. goto continuefp
  248. :ansefp
  249. set ans1=%ans2%
  250. set ans2=%ans3%
  251. set ans3=%ans4%
  252. set ans4=%ans5%
  253. set ans5=%ans6%
  254. set ans6=%ans7%
  255. set ans7=%ans8%
  256. set ans8=F(%x%)=!answer%a%!
  257. set answer1=%answer2%
  258. set answer2=%answer3%
  259. set answer3=%answer4%
  260. set answer4=%answer5%
  261. set answer5=%answer6%
  262. set answer6=%answer7%
  263. set answer7=%answer8%
  264. set a=8
  265. goto continuefp
  266. :absolute
  267. cls
  268. echo Absolutes in simple form are of the following:
  269. echo G(x)=r^|x-h^|+k
  270. echo where r is the rate of change.
  271. echo where h,k is the vertex
  272. echo a should not be zero (0).
  273. set /p r=Value for r:
  274. set /p h=Value for h:
  275. set /p k=Value for k:
  276. :checkabso
  277. if %r%==0 (
  278. set /p r=Please enter a new value for r:
  279. goto checkabso
  280. )
  281. :askcorrectfa
  282. echo Is this correct? G(x)=%r%^|x-%h%^|+%k%
  283. set /p askfa=(Y/N)
  284. if %askfa%==n goto functions
  285. :continuefa
  286. cls
  287. echo Type "top" to go to top
  288. echo Type "f" to change functions
  289. echo.
  290. echo G(x)=%r%^|x-%h%^|+%k%
  291. echo 1) %ans1%
  292. echo 2) %ans2%
  293. echo 3) %ans3%
  294. echo 4) %ans4%
  295. echo 5) %ans5%
  296. echo 6) %ans6%
  297. echo 7) %ans7%
  298. echo 8) %ans8%
  299. set /p x=What would you like to set x as?
  300. if /i %x%==top goto top
  301. if /i %x%==f goto functions
  302. set /a a+=1
  303. set /a base=(%x%-%h%)
  304. set answer%a%=1
  305. if %base% LSS 0 set /a base*=-1
  306. set /a answer%a%*=%base%
  307. set /a answer%a%=(%r%*!answer%a%!)+%k%
  308. if %a%==9 goto ansefa
  309. set ans%a%=G(%x%)=!answer%a%!
  310. goto continuefa
  311. :ansefa
  312. set ans1=%ans2%
  313. set ans2=%ans3%
  314. set ans3=%ans4%
  315. set ans4=%ans5%
  316. set ans5=%ans6%
  317. set ans6=%ans7%
  318. set ans7=%ans8%
  319. set ans8=G(%x%)=!answer%a%!
  320. set answer1=%answer2%
  321. set answer2=%answer3%
  322. set answer3=%answer4%
  323. set answer4=%answer5%
  324. set answer5=%answer6%
  325. set answer6=%answer7%
  326. set answer7=%answer8%
  327. set a=8
  328. goto continuefa
  329. :rational
  330. cls
  331. echo Rationals in simple form are of the following:
  332. echo H(x)=(r/x-h)+k
  333. echo where r is the rate of change.
  334. echo where h is the horizontal asymptote.
  335. echo and k is the vertical asymptote.
  336. echo a should not be zero (0).
  337. set /p r=Value for r:
  338. set /p h=Value for h:
  339. set /p k=Value for k:
  340. :checkrati
  341. if %r%==0 (
  342. set /p r=Please enter a new value for r:
  343. goto checkrati
  344. )
  345. :askcorrectfr
  346. echo Is this correct? H(x)=(%r%/x-%h%)+%k%
  347. set /p askfr=(Y/N)
  348. if %askfr%==n goto functions
  349. :continuefr
  350. cls
  351. echo Type "top" to go to top
  352. echo Type "f" to change functions
  353. echo.
  354. echo H(x)=(%r%/%x%-%h%)+%k%
  355. echo 1) %ans1%
  356. echo 2) %ans2%
  357. echo 3) %ans3%
  358. echo 4) %ans4%
  359. echo 5) %ans5%
  360. echo 6) %ans6%
  361. echo 7) %ans7%
  362. echo 8) %ans8%
  363. set /p x=What would you like to set x as?
  364. if /i %x%==top goto top
  365. if /i %x%==f goto functions
  366. set /a a+=1
  367. set /a base=(%x%-%h%)
  368. set answer%a%=%r%
  369. set /a answer%a%/=%base%
  370. set /a answer%a%=!answer%a%!+%k%
  371. if %af%==9 goto ansefr
  372. set ans%a%=H(%x%)=!answer%a%!
  373. goto continuefr
  374. :ansefr
  375. set ans1=%ans2%
  376. set ans2=%ans3%
  377. set ans3=%ans4%
  378. set ans4=%ans5%
  379. set ans5=%ans6%
  380. set ans6=%ans7%
  381. set ans7=%ans8%
  382. set ans8=H(%x%)=!answer%a%!
  383. set answer1=%answer2%
  384. set answer2=%answer3%
  385. set answer3=%answer4%
  386. set answer4=%answer5%
  387. set answer5=%answer6%
  388. set answer6=%answer7%
  389. set answer7=%answer8%
  390. set a=8
  391. goto continuefr
  392. :linear
  393. cls
  394. echo Linear in simple form are of the following:
  395. echo I(x)=rx+b
  396. echo where r is the rate of change.
  397. echo where b is the y-intercept.
  398. echo a should not be zero (0).
  399. set /p r=Value for r:
  400. set /p b=Value for b:
  401. :checkline
  402. if %r%==0 (
  403. set /p r=Please enter a new value for r:
  404. goto checkabso
  405. )
  406. :askcorrectfl
  407. echo Is this correct? I(x)=%r%x+%b%
  408. set /p askfl=(Y/N)
  409. if %askfl%==n goto functions
  410. :continuefl
  411. cls
  412. echo Type "top" to go to top
  413. echo Type "f" to change functions
  414. echo.
  415. echo I(x)=%r%x+%b%
  416. echo 1) %ans1%
  417. echo 2) %ans2%
  418. echo 3) %ans3%
  419. echo 4) %ans4%
  420. echo 5) %ans5%
  421. echo 6) %ans6%
  422. echo 7) %ans7%
  423. echo 8) %ans8%
  424. set /p x=What would you like to set x as?
  425. if /i %x%==top goto top
  426. if /i %x%==f goto functions
  427. set /a a+=1
  428. set /a answer%a%=(%r%*%x%)+%b%
  429. if %a%==9 goto ansefl
  430. set ans%a%=I(%x%)=!answer%a%!
  431. goto continuefl
  432. :ansefl
  433. set ans1=%ans2%
  434. set ans2=%ans3%
  435. set ans3=%ans4%
  436. set ans4=%ans5%
  437. set ans5=%ans6%
  438. set ans6=%ans7%
  439. set ans7=%ans8%
  440. set ans8=I(%x%)=!answer%a%!
  441. set answer1=%answer2%
  442. set answer2=%answer3%
  443. set answer3=%answer4%
  444. set answer4=%answer5%
  445. set answer5=%answer6%
  446. set answer6=%answer7%
  447. set answer7=%answer8%
  448. set a=8
  449. goto continuefl
  450.  
Advertisement
Add Comment
Please, Sign In to add comment