Well gdk isn't really our thing here, this is the DarkBASIC Classic forum.
That being said, my initial approach here would be to find the values of each digit of the number. Easy way would be to declare an array with as many slots as there are digits (convert the number to a string and check the number of characters). Once there you can figure out the appropriate roman numerals for each digit.
I will try to throw some DBC code together as an example (this seems like an interesting challenge).
[EDIT]
Alright, since you will be translating, I threw in plenty of comments so that you can understand WHAT is going on and why and how it works and all that jazz. BTW, thanks. This was a pretty fun little challenge.
REM Get the constants ready
DIM NumRef(100)
NumRef(1)=1
NumRef(2)=5
NumRef(3)=10
NumRef(4)=50
NumRef(5)=100
NumREF(6)=500
NumRef(7)=1000
NumRef(8)=5000
NumRef(9)=10000
DIM Numeral$(9)
Numeral$(1)="I"
Numeral$(2)="V"
Numeral$(3)="X"
Numeral$(4)="L"
Numeral$(5)="C"
Numeral$(6)="D"
Numeral$(7)="M"
Numeral$(8)="(V)"
REM Dissect the number to be converted and place into an array
REM NOTE: The array contains it backwards (ie 4-3-2-1) so that its position
REM In the array represents its value more clearly (4*10^0)+(3*10^1)+(2*10^2)+(1*10^3)
Number=1234
ValNum=Len(STR$(Number))
Dim Numbers(ValNum)
For i=0 to ValNum
Numbers(ValNum-I)=VAL(Mid$(Str$(Number),I+1))
NEXT I
Numeral$=""
REM Begin Conversion. Working backwards through the array (number goes left->right)
FOR I=ValNum to 1 step -1
REM Since the number is 1000+200+30+4 take the number and multiply it by 10^X
REM Where X is the appropriate power of 10 (or 1 less than the digit number)
CurNum=Numbers(I)*(10^(I-1))
REM Find out what the reference number is
Ref=GetRef(CurNum)
REM Calc the difference (used to determine if you need to add more to the end
REM or one to the front ex: IX for 9 or XI for 11)
Dif=NumRef(ref)-CurNum
REM If the reference number is <value then you will just need to repeat the
REM Ref numeral the correct number of times (200=cc 300=ccc etc)
IF Dif<=0
additional=CurNum/NumREF(ref)
FOR X=1 to additional
add$=add$+numeral$(ref)
NEXT X
ENDIF
REM If the ref number>value you need to do the subtraction thing
IF Dif>0
REM The values go 1,5,1,5,1,5,1,5 and so on, so you just need
REM To find the symbol of the reference number 1 or 2 less than your
REM actual reference symbol (ex: to make 9, you need 10 (ref number 3)
REM and 1 (ref number 1) which are put together for IX)
if left$(str$(numref(getref(curnum))),1)="5"
change=1
else
change=2
endif
add$=numeral$(ref-change)+numeral$(ref)
ENDIF
Numeral$=Numeral$+add$
add$=""
NEXT I
print numeral$
END
REM This will find the reference number for the number given
REM Roman Numerals use a system where it will be A+X until it can be stated
REM as B-X (so I,II,III,IV,V). The reference number is either A or B, depending
REM on what the number is (if the number is 4, ref number is 5 but if the num
REM is 3, ref number is 1)
FUNCTION GetRef(num)
I=8
REM Starting with the largest ref numbers, decrease until you pass by the
REM number. This is your A value
REPEAT
DEC I
UNTIL NumRef(I)<=num
REM Set your Start and finish values (A and B respectively)
Start=NumRef(I)
Finish=NumRef(I+1)
REM This will determine if the number needs to be divided by 1 or just a
REM factor of itself. This is used to determine what value of X is required
REM To become subtraction rather than addition. EX. 900 is 1000-100
REM 800 is 500+300
Divider#=Val(Left$(STR$(Finish),1))
IF VAL(LEFT$(STR$(Finish),1))=1
Divider#=Divider#*10.0
ENDIF
NormalEND#=(Finish*1.0)/(divider#)
REM If the problem is subtraction, ref number is B, otherwise A
IF Finish-num<=NormalEND#
REF=I+1
ELSE
REF=I
ENDIF
ENDFUNCTION REF
Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose