manhhnvn Posted February 27, 2010 Share Posted February 27, 2010 I was Vietnam English is not my look at your sympathy is the code I write to solve equations 2 but if it bugs where people see Help with thanks 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("Tinh Nghiem PT Bac 2", 515, 469, 225, 124) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) GUISetBkColor(0x85878C) $Label1 = GUICtrlCreateLabel("Nhap gia tri cua a", 56, 40, 88, 17) GUICtrlSetBkColor(-1, 0xFF00FF) $Label2 = GUICtrlCreateLabel("Nhap gia tri cua b", 56, 80, 88, 17) GUICtrlSetBkColor(-1, 0xFF00FF) $Label3 = GUICtrlCreateLabel("Nhap gia tri cua c", 56, 128, 88, 17) GUICtrlSetBkColor(-1, 0xFF00FF) $Input1 = GUICtrlCreateInput("1", 160, 40, 217, 21) $Input2 = GUICtrlCreateInput("0", 160, 80, 217, 21) $Input3 = GUICtrlCreateInput("0", 160, 128, 217, 21) $Button1 = GUICtrlCreateButton("Tinh Nghiem", 168, 184, 153, 65, 0) $Label4 = GUICtrlCreateLabel("x 1 =", 56, 272, 27, 17) $Label5 = GUICtrlCreateLabel("x 2 =", 56, 336, 27, 17) $Input4 = GUICtrlCreateInput("0", 112, 272, 265, 21) $Input5 = GUICtrlCreateInput("0", 112, 328, 265, 21) $Group1 = GUICtrlCreateGroup("Nhap", 24, 16, 409, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Xuat", 24, 256, 417, 145) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit ElseIf $nMsg = $Button1 Then $doc1 = GUICtrlRead($Input1) $doc2 = GUICtrlRead($Input2) $doc3 = GUICtrlRead($Input3) If $doc1 = 0 Then If $doc2 = 0 Then If $doc3 = 0 Then MsgBox(0, "TB","PT vo so nghiem") Else MsgBox(0,"TB","PT vo nghiem") EndIf Else $x = - $doc3/$doc2 GUICtrlSetData($Input4,$x) GUICtrlSetData($Input4,$x) EndIf Else $delta = $doc2 * $doc2 - 4 * $doc1 * $doc3 $x0 = (- $doc2 + Sqrt($delta))/(2 * $doc1) GUICtrlSetData($Input4,$x0) $x00 = (- $doc2 - Sqrt($delta))/(2 * $doc1) GUICtrlSetData($Input4,$x00) EndIf EndIf WEnd try running it the following error >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\AutoIT\under construction\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>13:57:11 Starting AutoIt3Wrapper v.2.0.1.22 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3 D:\AutoIT\under construction\test.au3(38,2) : ERROR: missing Wend. ElseIf ^ D:\AutoIT\under construction\test.au3(35,1) : REF: missing Wend. While ^ D:\AutoIT\under construction\test.au3(38,2) : ERROR: syntax error ElseIf ^ D:\AutoIT\under construction\test.au3 - 2 error(s), 0 warning(s) !>13:57:11 AU3Check ended.rc:2 >Running:(3.3.4.0):C:\Program Files\AutoIt3\autoit3.exe "D:\AutoIT\under construction\test.au3" D:\AutoIT\under construction\test.au3 (38) : ==> "Else" statement with no matching "If" statement.: ElseIf $nMsg = $Button1 Then ->13:57:12 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 2.845 Link to comment Share on other sites More sharing options...
chasedream Posted February 27, 2010 Share Posted February 27, 2010 If $nMsg = $Button1 Then Link to comment Share on other sites More sharing options...
manhhnvn Posted February 27, 2010 Author Share Posted February 27, 2010 If $nMsg = $Button1 Thenyou can say more clearly is not Link to comment Share on other sites More sharing options...
Bowmore Posted February 27, 2010 Share Posted February 27, 2010 (edited) While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit ;<===== Then Exit completes If statement If $nMsg = $Button1 Then ;<===== Changed ElseIf to If $doc1 = GUICtrlRead($Input1) $doc2 = GUICtrlRead($Input2) $doc3 = GUICtrlRead($Input3) If $doc1 = 0 Then If $doc2 = 0 Then If $doc3 = 0 Then MsgBox(0, "TB", "PT vo so nghiem") Else MsgBox(0, "TB", "PT vo nghiem") EndIf Else $x = -$doc3 / $doc2 GUICtrlSetData($Input4, $x) GUICtrlSetData($Input4, $x) EndIf Else $delta = $doc2 * $doc2 - 4 * $doc1 * $doc3 $x0 = (-$doc2 + Sqrt($delta)) / (2 * $doc1) GUICtrlSetData($Input4, $x0) $x00 = (-$doc2 - Sqrt($delta)) / (2 * $doc1) GUICtrlSetData($Input4, $x00) EndIf EndIf WEnd [/font][font="Courier New"] Edited February 27, 2010 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
manhhnvn Posted February 28, 2010 Author Share Posted February 28, 2010 While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit ;<===== Then Exit completes If statement If $nMsg = $Button1 Then ;<===== Changed ElseIf to If $doc1 = GUICtrlRead($Input1) $doc2 = GUICtrlRead($Input2) $doc3 = GUICtrlRead($Input3) If $doc1 = 0 Then If $doc2 = 0 Then If $doc3 = 0 Then MsgBox(0, "TB", "PT vo so nghiem") Else MsgBox(0, "TB", "PT vo nghiem") EndIf Else $x = -$doc3 / $doc2 GUICtrlSetData($Input4, $x) GUICtrlSetData($Input4, $x) EndIf Else $delta = $doc2 * $doc2 - 4 * $doc1 * $doc3 $x0 = (-$doc2 + Sqrt($delta)) / (2 * $doc1) GUICtrlSetData($Input4, $x0) $x00 = (-$doc2 - Sqrt($delta)) / (2 * $doc1) GUICtrlSetData($Input4, $x00) EndIf EndIf WEnd [/font][font="Courier New"] thank you it works very well 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