Drifter Posted September 13, 2010 Share Posted September 13, 2010 This algorithm is supposed to convert base 10 to base 48.expandcollapse popupFunc convertNum($n) ;This function takes a base 10 number and converts it to base 48 ;the values for each place are currently represented in decimal, but will soon be shown as a-z and A-V. ;Find the highest base 48 value that we will need. $j = 0 While 1 If (48^$j * 48) - 1 <= $n Then $j += 1 Else ExitLoop(1) EndIf WEnd ;$j now contains the highest power of 48 needed. Local $outArray[$j + 1] $outStr = "" For $k = $j To 0 Step -1 ;represent the value for this place $outArray[$k] = Int($n / (48 ^ $k)) ;remove it from the original number $n -= ($outArray[$k] * (48 ^ $k)) Next For $i = 0 To $j ;show the values for each place, seperated by a comma. $outStr &= $outArray[$i] & "," Next Return $outStr EndFuncWhat exactly is wrong? Link to comment Share on other sites More sharing options...
Drifter Posted September 13, 2010 Author Share Posted September 13, 2010 solved now, sorry about that! 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