mesale0077 Posted July 18, 2012 Share Posted July 18, 2012 (edited) Edited September 4, 2014 by mesale0077 Quote Link to comment Share on other sites More sharing options...
blackman12 Posted July 19, 2012 Share Posted July 19, 2012 [codebox]MsgBox(0,"",_TekHane(1231525)) Func _TekHane($number) if Not IsNumber($number) Then Return -1 Local $return = 10, $ilk = 1 While $return>9 if $ilk Then $yeniden = StringSplit($number,"") $ilk = 0 Else $yeniden = StringSplit($return,"") EndIf $return = 0 for $i = 1 to $yeniden[0] $return += $yeniden[$i] Next ConsoleWrite($return&@CRLF) WEnd Return $return EndFunc [/codebox] Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted July 19, 2012 Author Share Posted July 19, 2012 kodda sıkıntı yaşıyorum [code]#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 312, 463, 449, 224) $Input1 = GUICtrlCreateInput("04061984", 16, 80, 257, 21) $Edit1 = GUICtrlCreateEdit("", 16, 144, 257, 249,BitOR($ES_AUTOVSCROLL,$WS_VSCROLL)) $Label3 = GUICtrlCreateLabel("Sonuç:", 128, 120, 38, 17) $Button1 = GUICtrlCreateButton("Hesapla", 24, 416, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($Edit1,_TekHane(GUICtrlRead($Input1))) EndSwitch WEnd Func _TekHane($number) if Not IsNumber($number) Then Return -1 Local $return = 10, $ilk = 1 While $return>9 if $ilk Then $yeniden = StringSplit($number,"") $ilk = 0 Else $yeniden = StringSplit($return,"") EndIf $return = 0 for $i = 1 to $yeniden[0] $return += $yeniden[$i] Next ConsoleWrite($return&@CRLF) WEnd Return $return EndFunc [/code] Quote Link to comment Share on other sites More sharing options...
blue_life Posted July 19, 2012 Share Posted July 19, 2012 [codebox]$Form1 = GUICreate("[#] Form1 [#]", 312, 463, 449, 224) $Input1 = GUICtrlCreateInput("04061984", 16, 80, 257, 21, 0x2000) $Edit1 = GUICtrlCreateEdit("", 16, 144, 257, 249) $Label3 = GUICtrlCreateLabel("Sonuç:", 128, 120, 38, 17) $Button1 = GUICtrlCreateButton("Hesapla", 24, 416, 97, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $Button1 GUICtrlSetData($Edit1, _TekHane(GUICtrlRead($Input1))) EndSwitch WEnd Func _TekHane($Number) Local $ReNumber, $i Local $Split = StringSplit(String($Number), "") For $i = 1 To $Split[0] $ReNumber += Number($Split[$i]) Next ConsoleWrite($ReNumber & @CRLF) If $ReNumber > 9 Then $ReNumber = _TekHane($ReNumber) Return Number($ReNumber) EndFunc ;==>_TekHane[/codebox] Quote Link to comment Share on other sites More sharing options...
blackman12 Posted July 19, 2012 Share Posted July 19, 2012 "if Not IsNumber($number) Then Return -1" satırını kaldırırsan sorun da ortadan kalkar. yani şöyle olacak fonksiyon. [code]Func _TekHane($number) ;if Not IsNumber($number) Then Return -1 Local $return = 10, $ilk = 1 While $return>9 if $ilk Then $yeniden = StringSplit($number,"") $ilk = 0 Else $yeniden = StringSplit($return,"") EndIf $return = 0 for $i = 1 to $yeniden[0] $return += $yeniden[$i] Next ConsoleWrite($return&@CRLF) WEnd Return $return EndFunc[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.