' RomanNumeral.sb
'This program was written by "Glennium"
Start:
Bloc()' Loads Roman Numerals into Letters Array
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
TextWindow.WriteLine("")
TextWindow.Write("Please enter an integer from 1 to 3999; or ''Return'' to quit...")
i = TextWindow.ReadNumber()
len = Text.GetLength(i)
j =Math.Floor(i)
If i = 0 Then
Goto Endprog
ElseIf i < 0 Then 'tests if i is positive
TextWindow.WriteLine("You must enter a number greater than Zero")
Goto start
Elseif i > j Then 'tests if i is an integer
TextWindow.WriteLine("You did not enter an integer.")
Goto start
Elseif i >= 4000 Then
TextWindow.WriteLine("You must enter a number from 1 to 3999")
'TODO take care of this problem when using Graphics window...
EndIf
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OutP
TextWindow.WriteLine("")
For B = len to 1 Step -1
TextWindow.Write(Letters[B][Digits[B]])
EndFor
TextWindow.WriteLine("")
EndSub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub StripAndLoad
X= Math.Power(10,len-1)' creates a multiplier to help strip off the digits
len2 = len 'creates the second length variable so len will not be dammaged
For Counter = len To 1 Step -1
Z = math.Floor(i/X) 'Z is the first digit in the line each iteration.
Digits[len2] = Z
len2 = len2 -1
i= i - (X*Z)
X= X / 10