มือใหม่หัดเขียนครับ งงจริงๆ
ความคิดที่ต้องการคือ
ใส่ตัวเลข Input แล้ว กด OK
แล้วโปรแกรมจะเอาไปคำนวณ
แปลออกมาเป็นตัวอักษร
เช่น ผมใส่ 999 ตามโจทย์ด้านล่าง คือ
999-1 = 998 แล้วเอาไป +100 =1098
แล้ว ก็เอา 1098-ด้วย999 ก็จะ = 99
แล้วเอา 99 แปลงเป็น KK
รบกวนชี้แนะด้วยครับ
ขอบคุณครับ
ความคิดที่ต้องการคือ
ใส่ตัวเลข Input แล้ว กด OK
แล้วโปรแกรมจะเอาไปคำนวณ
แปลออกมาเป็นตัวอักษร
เช่น ผมใส่ 999 ตามโจทย์ด้านล่าง คือ
999-1 = 998 แล้วเอาไป +100 =1098
แล้ว ก็เอา 1098-ด้วย999 ก็จะ = 99
แล้วเอา 99 แปลงเป็น KK
รบกวนชี้แนะด้วยครับ
ขอบคุณครับ
- Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 368, 40, 192, 114)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 265, 21)
$Button1 = GUICtrlCreateButton("OK", 280, 8, 81, 25)
GUISetState(@SW_SHOW)
GUICtrlSetData($Input1,genpass())
#EndRegion ### END Koda GUI section ###
While 1
$Input = GUICtrlRead ($Input1)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Input1,genpass())
EndSwitch
WEnd
Func genpass ()
$genpass = $Input1 - 1
$genpass = $genpass + 100
$genpass = $genpass - $Input1
$genpass = StringReplace($genpass, "1", "A")
$genpass = StringReplace($genpass, "2", "B")
$genpass = StringReplace($genpass, "3", "C")
$genpass = StringReplace($genpass, "4", "D")
$genpass = StringReplace($genpass, "5", "E")
$genpass = StringReplace($genpass, "6", "F")
$genpass = StringReplace($genpass, "7", "G")
$genpass = StringReplace($genpass, "8", "H")
$genpass = StringReplace($genpass, "9", "K")
$genpass = StringReplace($genpass, "0", "Z")
Return $genpass
EndFunc