<求助>找出edit1'2'3內數字的最大值
本帖最后由 tcpuuu 于 2010-9-26 17:08 编辑GUICreate("COM", 138, 100, 880, 2)
$L1 = GUICtrlCreateInput("", 1, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L2 = GUICtrlCreateInput("", 34, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L3 = GUICtrlCreateInput("", 67, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L4 = GUICtrlCreateInput("", 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L5 = GUICtrlCreateInput("", 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L6 = GUICtrlCreateInput("", 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$1Button = GUICtrlCreateButton("挑選最大值", 2, 66, 70, 30)
;----------------------------------------------------------
GUISetState()
While 1
WEnd32 1Edit1 最大Edit4填入1
12 3Edit3 最大Edit6填入1
如果是 2 2 2 Edit3填入1
如果是 2 2 1 Edit1 Edit2 一樣大Edit5填入1
1 2 2 Edit2 Edit3 一樣大Edit6填入1
2 1 2 Edit1 Edit3 一樣大Edit6填入1
----------------------------------------------------
請求各位高手 解說! 謝謝 #include <Array.au3>
Local $avArray =
MsgBox(0,'最大数学值', _ArrayMax($avArray, 1, 1)) 本帖最后由 afan 于 2010-9-26 17:59 编辑
呵呵,又来搞数字了 O(∩_∩)O~
“如果是 2 2 2 Edit3填入1” 按你的逻辑应该是 Edit6填入1 吧GUICreate('COM', 138, 100, 880, 2)
$L1 = GUICtrlCreateInput('', 1, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L2 = GUICtrlCreateInput('', 34, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L3 = GUICtrlCreateInput('', 67, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L4 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L5 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L6 = GUICtrlCreateInput('', 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$Button1 = GUICtrlCreateButton('挑選最大值', 2, 70, 70, 25)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $Button1
_Max()
EndSwitch
WEnd
Func _Max()
Local $v1 = Number(GUICtrlRead($L1))
Local $v2 = Number(GUICtrlRead($L2))
Local $v3 = Number(GUICtrlRead($L3))
Local $max = $v1, $x = 1, $i
For $i = 2 To 3
If Eval('v' & $i) >= $max Then
$max = Eval('v' & $i)
$x = $i
EndIf
Next
For $i = 4 To 6
GUICtrlSetData(Eval('L' & $i), '')
Next
GUICtrlSetData(Eval('L' & $x + 3), 1)
EndFunc ;==>_max
光看标题切了,没注意内容。
看来我理解错LZ的意思了,不好意思! 本帖最后由 tcpuuu 于 2010-9-26 19:34 编辑
感謝! 你們 解答
Edit2 / Edit1
結果寫入Edit3 (用%表示)
另外底下這個 拜託了!
WinKill("COM")
GUICreate("COM", 138, 100, 880, 2)
$L1 = GUICtrlCreateInput("總次數 ", 1, 10, 50, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L2 = GUICtrlCreateInput("命中次數", 54, 10, 40, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L3 = GUICtrlCreateInput("", 72, 46, 50, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$1Button = GUICtrlCreateButton("命中率%", 1, 42, 70, 30)
;----------------------------------------------------------
GUISetState()
While 1
WEnd-------------------------------------------------------------------------------------
還有我是要 edit4 5 6 挑選寫入edit1516 17
要怎麼改 底下這段
-------------------------------------------------------
Func _Max()
Local $v1 = Number(GUICtrlRead($L4))
Local $v2 = Number(GUICtrlRead($L5))
Local $v3 = Number(GUICtrlRead($L6))
Local $max = $v1, $x = 1, $i
For $i = 5 To 6
If Eval('v' & $i) >= $max Then
$max = Eval('v' & $i)
$x = $i
EndIf
Next
For $i = 15 To 17
GUICtrlSetData(Eval('L' & $i), '')
Next
GUICtrlSetData(Eval('L' & $x + 3), 1)
EndFunc ;==>_max afan超級版主 你在那兒ㄚ?
页:
[1]