On Sun, 18 Apr 1999, Sean 'Captain Napalm' Conner wrote:
Problem: Convert a binary value to Roman, using ASCII
characters (or
the native character set if applicable) into a string
with a termination character (if ASCII, use the NUL (0)
character).
The valid Roman characters used are:
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
I will assume that all are familiar with how the conversion
goes 8-) The smallest value allowed is 1, and the largest
is 3,999. Any value out of this range is to be represented
as a single character consisting of an asterick (*) or some
other similar character in whatever character set (if ASCII
isn't supported) followed by the termination character.
This means that the longest string is 10 characters long:
`M' `M' `M' `C' `M' `X' `C' `I' `X'
<termination>
I must be missing something here. 9 does NOT produce the longest string
< 10, 8 does. (IX v VIII), and 3999 isn't the longest string.
3888 would seem to produce:
M M M D C C C L X X X V I I I \0
which is 16 characters, including null.
BTW, what comes after M? Is it correct that in Roman numerals there can
never be 4 consecutive occurences of the same letter? (The original Y4M
"bug"!!!)
--
Fred Cisin cisin(a)xenosoft.com
XenoSoft
http://www.xenosoft.com
2210 Sixth St. (510) 644-9366
Berkeley, CA 94710-2219