IchBistTod Posted August 30, 2009 Share Posted August 30, 2009 Follow the instructions, the attached image is needed. This app will find the missing side of a right triangle using sine, cosine, or tangent, it will auto detect and preform the calculation needed. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Missing Side Finder(Sin, CoSine, Tangent)", 496, 409, 192, 124) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic(@ScriptDir&"\right.jpg", 80, 0, 412, 404, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetState(-1, $GUI_DISABLE) $angle1 = GUICtrlCreateInput("angle1", 104, 40, 73, 21) $angle2 = GUICtrlCreateInput("angle2", 240, 288, 73, 21) $Side1_hypotenuse = GUICtrlCreateInput("Side1_hypotenuse", 224, 144, 121, 21) $side2 = GUICtrlCreateInput("side2", 136, 320, 121, 21) $side3 = GUICtrlCreateInput("side3", 8, 200, 121, 21) $Label1 = GUICtrlCreateLabel("To find the length of a missing side fill in all information, use X to represent the missing side", 32, 344, 426, 17) $Label2 = GUICtrlCreateLabel("For the angle/side(s) you do not have info for simply type in N/A", 80, 368, 310, 17) $Solve = GUICtrlCreateButton("Solve", 344, 32, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Solve $hyp = GUICtrlRead($Side1_hypotenuse) $anglea = GUICtrlRead($angle1) $angleb = GUICtrlRead($angle2) ;switch to determine Tan or Sin/Cos Switch $hyp case "N/A" $type = "TAN" case Else $type = "SIN/COS" EndSwitch ConsoleWrite($type&@CRLF) ;end of switch ;switch to act on based off Tan or Sin/Cos switch $type case "TAN" if $angleb = "N/A" Then $O = guictrlread($side2) $A = guictrlread($side3) $active_angle = $anglea EndIf if $anglea = "N/A" Then $A = guictrlread($side2) $O = guictrlread($side3) $active_angle = $angleb ConsoleWrite($active_angle&@CRLF) EndIf $pi = 3.14159265358979 $degToRad = $pi / 180 $tan = tan($active_angle * $degToRad) ConsoleWrite($tan&@CRLF) if $A = "X" Then $result = $O / $tan EndIf if $O = "X" Then $result = $A * $tan EndIf case "SIN/COS" if $angleb = "N/A" Then $O = guictrlread($side2) $A = guictrlread($side3) $active_angle = $anglea EndIf if $anglea = "N/A" Then $A = guictrlread($side2) $O = guictrlread($side3) $active_angle = $angleb ConsoleWrite($active_angle&@CRLF) EndIf ;cos if $O="N/A" Then $type = "COS" $pi = 3.14159265358979 $degToRad = $pi / 180 $COS = Cos($active_angle * $degToRad) ConsoleWrite($A&" "&$hyp) ;hyp is unknown if $hyp = "X" Then ConsoleWrite($A&" * "&$COS) $result = $A / $COS EndIf ;end hyp uknown ;adj is unknown if $A = "X" Then $result = $hyp * $COS EndIf ;end adj unknown EndIf ;end cos ;sin if $A="N/A" Then $type = "SIN" $pi = 3.14159265358979 $degToRad = $pi / 180 $SIN = sin($active_angle * $degToRad) ConsoleWrite($o&" "&$hyp&" "&$SIN) ;hyp is unknown if $hyp = "X" Then ConsoleWrite($O&" * "&$O) $result = $O / $SIN EndIf ;end hyp uknown ;op is unknown if $O = "X" Then $result = $hyp * $SIN EndIf ;end op unknown EndIf ;end sin Endswitch ;end solving switch MsgBox(64, "Result", "Equation type required to solve = "&$type&@CRLF&"X = "& $result) EndSwitch WEnd [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
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