NELyon Posted March 6, 2008 Posted March 6, 2008 (edited) Super simple implementation of the Pythagorean Theorem in Autoit and in PHP.Autoit:MsgBox(0, "Hypotenuse", "The hypotenuse of a trangle with side lengths of "&@CRLF&"3 and 4 are"&Hypotenuse(3, 4)); func Hypotenuse($a, $b) $c = $a*$a+$b*$b; return sqrt($c); endfuncQuick, Easy, Made it to cheat in math J/KPHP:<?php echo hypotenuse($_GET['a'], $_GET['b']); function hypotenuse($a, $b) { $c2 = $a*$a+$b*$b; return sqrt($c2); } ?>Example of PHP:http://dbak.mine.nu/kenton/hypoexam.php?a=3&b=4I love math. Edited March 6, 2008 by Senton-Bomb
XxXFaNtA Posted March 6, 2008 Posted March 6, 2008 func Hypotenuse($a, $ return sqrt($a^2+$b^2) endfunc ;> I think it might take longer to type it then to actually do it on your own ;> /[center][/center]
weaponx Posted March 6, 2008 Posted March 6, 2008 I was expecting some sort of fancy triangle solver like this:http://www.webmath.com/rtri.html
Achilles Posted March 6, 2008 Posted March 6, 2008 I actually made a function for this on my graphing calculator... I don't do math much on the computer though.. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
NELyon Posted March 6, 2008 Author Posted March 6, 2008 func Hypotenuse($a, $ return sqrt($a^2+$b^2)endfunc;>I think it might take longer to type it then to actually do it on your own ;>Not when your teacher makes you write it out like this A^2+B^2=C^23^2+4^2=C^29+16=c^2C^2 = 25Sqrt(25) = CC=5When i type Sqrt, I mean the _/-- symbol that I just don't have sitting on my keyboard If we do it on a calculator or other means, we just have to give the answer.
DexterMorgan Posted March 7, 2008 Posted March 7, 2008 If you need to cheat in math class you can also use this so you dont need to keep opening the.au3 files $a = InputBox(" Pythagrorean Thingy","Leg 1 = ???") $b = InputBox("Pythagrorean Thingy","Leg 2 = ???") MsgBox(0,"Thing","If A= " & $a & " And B= " & $b & " Then the Hypotenuse is " & Hypotenuse($a, $); func Hypotenuse($a, $ $c = $a*$a+$b*$b; return sqrt($c); endfunc code
GEOSoft Posted March 7, 2008 Posted March 7, 2008 Super simple implementation of the Pythagorean Theorem in Autoit and in PHP. Autoit: MsgBox(0, "Hypotenuse", "The hypotenuse of a trangle with side lengths of "&@CRLF&"3 and 4 are"&Hypotenuse(3, 4)); func Hypotenuse($a, $b) $c = $a*$a+$b*$b; return sqrt($c); endfunc Quick, Easy, Made it to cheat in math J/K PHP: <?php echo hypotenuse($_GET['a'], $_GET['b']); function hypotenuse($a, $b) { $c2 = $a*$a+$b*$b; return sqrt($c2); } ?> Example of PHP: http://dbak.mine.nu/kenton/hypoexam.php?a=3&b=4 I love math.Good but it would be easier to understand if you write the $C = line as $c = ($a*$a)+($b*$; Or $c = ($a^2)+($b^2); George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now