Mat Posted October 13, 2010 Share Posted October 13, 2010 Ah right. In a / b, we call a the dividend and b the divisor. Is that what you wanted to know? AutoIt Project Listing Link to comment Share on other sites More sharing options...
Developers Jos Posted October 13, 2010 Developers Share Posted October 13, 2010 (edited) And I answered about mod. Maybe I wasn't clear. Instead of There's no specific part in help file that i dont understand. I should have said There's no specific part in mod() documentationthat I dont understand....I guess.How should I express myself if I want to say you that I was reading mod function from help file and there wasn't any specific part in mod's documentation in help file that I didn't understand..Ok, last energy i spent on this:When you open the Mod() func helppage the first line states:Performs the modulus operation. So Google search gave me a fist hit for "Modulus Operation" : http://en.wikipedia.org/wiki/Modulo_operationCase closed.Jos Edited October 13, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ericnail Posted October 13, 2010 Share Posted October 13, 2010 I need to convert number to char. 1=A 26=Z 27=AA By what logic i can convert random int to A-Z string? I cant find any logig. You said 27 = AA, which I find weird because i would thing 27 = (26 + 1) AKA "ZA". But, I assumed you wanted to have the excess multiplied onto the origional. Anyway, here: expandcollapse popup#include <Array.au3> HotKeySet("{F6}", "CalculateNum") Global $char_string Dim $Value[1], $String[1], $values[1] While 1 Sleep(20) WEnd Func CalculateNum() $Num = InputBox("Input Number", "Enter Number:") $Answer = GetNumber($Num) MsgBox(1, "Done!", "Your Calculated String: " & $Answer) EndFunc Func GetNumber($Num) Local $count = 0 If $Num > 26 Then Do $Num_Count = $Num - 26 $count =+1 Until $Num_Count < 27 $sub = 26 * $count $send_val = $Num - $Sub $remainder = AlphGet($send_val) $values[0] = $remainder For $i = 1 to $count ReDim $values[$count +1] $values[$i] = $remainder Next $String = _ArrayToString($values,"") Return $String Else Return AlphGet($Num) EndIf EndFunc Func AlphGet($Num) Switch $Num Case 1 Return "A" Case 2 Return "B" Case 3 Return "C" Case 4 Return "D" Case 5 Return "E" Case 6 Return "F" Case 7 Return "G" Case 8 Return "H" Case 9 Return "I" Case 10 Return "J" Case 11 Return "K" Case 12 Return "L" Case 13 Return "M" Case 14 Return "N" Case 15 Return "0" Case 16 Return "P" Case 17 Return "Q" Case 18 Return "R" Case 19 Return "S" Case 20 Return "T" Case 21 Return "U" Case 22 Return "V" Case 23 Return "W" Case 24 Return "X" Case 25 Return "Y" Case 26 Return "Z" EndSwitch EndFunc Link to comment Share on other sites More sharing options...
E1M1 Posted October 13, 2010 Author Share Posted October 13, 2010 Thanks again. ericnail You did it backwards too. but max number i can use is 52. edited Link to comment Share on other sites More sharing options...
Mat Posted October 13, 2010 Share Posted October 13, 2010 You said 27 = AA, which I find weird because i would thing 27 = (26 + 1) AKA "ZA". Here's a better explanation on the maths, because I think it's good to know: We count in base 10 (known as decimal). Here, each digit is ten time the last. Lets use 142 as our number: 100 | 10 | 1 1 | 4 | 2 this can be shown as increasing powers of ten: 10^2 | 10^1 | 10^0 1 | 4 | 2 in other bases, you just replace the ten with another number. In this case it's 26: 26^1 | 26^0 5 | 12 or in binary: 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 => 10001110 Usually this would be shown in a table, but sadly I can't do that here... I think you get the picture though. The only problem with bases higher than ten is that when we string those together we get: 512. But wait... is that 5 12 or 5 1 2, in the latter case you get: 3408 as the decimal, a long way out (in the wrong order of magnitude even). There are two ways of dealing with this. One is to add dots, so 5.12 in this case. Did you know an IP address is actually a base 256 number? 127.0.0.1 is 2130706433 in decimal. The other way is to use more characters. For base N you need N characters, so in hexadecimal (base 16) we use 0-9 and A-F. 142 in hex: 16^1 | 16^0 8 | 14 => 8.14 => 8E E is the 14th character in 0123456789ABCD[b]E[/b]F For this example, we use the alphabet, and no numbers. base 10: 142 base 26: 5.12 : EL And there we are, number bases are easy when you think of decimal as being a base. As a last little bit of work for you, whats the highest number you can count to on your fingers so that someone else could tell you exactly what number you were showing them? AutoIt Project Listing Link to comment Share on other sites More sharing options...
E1M1 Posted October 13, 2010 Author Share Posted October 13, 2010 10? edited Link to comment Share on other sites More sharing options...
Mat Posted October 13, 2010 Share Posted October 13, 2010 10?Je ne comprende pas AutoIt Project Listing Link to comment Share on other sites More sharing options...
Spiff59 Posted October 14, 2010 Share Posted October 14, 2010 I think this is what's needed? For $x = 1 To 705 ConsoleWrite(ToBase26($x) & @CRLF) Next Func ToBase26($i) Local $s = "" While $i $m = Mod($i, 26) If $m = 0 Then $m = 26 $s = Chr(64 + $m) & $s $i = ($i - $m) / 26 Wend Return $s EndFunc ;==>ToBase26 Link to comment Share on other sites More sharing options...
Mison Posted October 14, 2010 Share Posted October 14, 2010 Interesting topic, although I don't know if it's useful. Hi ;) 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