Introduction
Calculates X,Y,or H of a right-angled triangle. dialog included. screenshot below. syntax is /pythag
Screenshot
uploading..
; ===============
; Pythagoras' Theorem Calculator
; Usage:/pythag
; ===============
alias pythag dialog $iif($dialog(pythag),-v,-m) pythag pythag
dialog pythag {
option pixels
title "Pythagoras'"
size -1 -1 175 95
text "X:", 1, 5 7 20 13
text "Y:", 2, 5 28 20 13
text "H:", 3, 5 48 20 13
edit "", 101, 20 5 40 20, autohs
edit "", 102, 20 25 40 20, autohs
edit "", 103, 20 45 40 20, autohs
button "Calculate X", 201, 70 4 100 21, disabled
button "Calculate Y", 202, 70 24 100 21, disabled
button "Calculate H", 203, 70 44 100 21, disabled
edit "", 301, 5 70 143 20, read
button "?", 302, 150 69 20 22
}
on *:dialog:pythag:*:*: {
if ($devent == edit) { if ($did isnum 101-103) { did $iif($did(102) isnums && $did(103) isnum,-e,-b) $dname 201 | did $iif($did(101) isnum && $did(103) isnum,-e,-b) $dname 202 | did $iif($did(101) isnum && $did(102) isnum,-e,-b) $dname 203 } }
elseif ($devent == sclick) {
if ($did == 302) {
var %x = Pythagoras' Theorem states that the "H^2 = X^2 + Y^2" in right-angled triangles. $&
This calculator is a simple way to calculate the different angles easily. $crlf $+ $crlf $+ $&
Enter two values corresponding to "H", "X", or "Y" and a button will be enabled to calculate the other value (arbitary units). $&
Click the "Calculate [N]" button and the result will appear at the bottom of the dialog. $crlf $+ $crlf $+ $&
"H" $chr(9) $chr(9) Hypotenuse $crlf $+ "X" and "Y" $chr(9) Two other sides to the triangle
noop $input(%x,io,Pythagoras' Theorem Calcualator - Help)
}
elseif ($did isnum 201-203) {
did -ra $dname 301 $sqrt($calc(($iif($did == 203,$did(101),$did(103)) ^2) $iif($did == 203,+,-) ($iif($did == 202,$did(101),$did(102)) ^2)))
if (!$did(301)) { noop $input(Your input values were not correct and returned a false value. Please re-check them,wo,Pythagoras' Theorem Calcualator - Error) }
}
}
}