English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

4 answers

You can't!

2006-08-03 19:10:29 · answer #1 · answered by jemhasb 7 · 0 0

const char *Number_AsRomanString( int iNumber )
{
struct RomanDigit_t
{
char *m_psString;
int m_iValue;
};

static const RomanDigit_t RomanDigits[]=
{
{"M", 1000},
{"CM", 900},
{"D", 500},
{"CD", 400},
{"C", 100},
{"XC", 90},
{"L", 50},
{"XL", 40},
{"X", 10},
{"IX", 9},
{"V", 5},
{"IV", 4},
{"I", 1},
};

static char sRomanString[20];
sRomanString[0] = '\0';

for (int i=0; iNumber && i sizeof(RomanDigits[0]); i++)
{
while ( RomanDigits[i].m_iValue <= iNumber )
{
strcat( sRomanString, RomanDigits[i].m_psString );
iNumber -= RomanDigits[i].m_iValue;
}
}

return sRomanString;
}

2006-08-03 19:14:41 · answer #2 · answered by Kryzchek 4 · 0 0

Google it.

2006-08-03 19:14:44 · answer #3 · answered by JKP 2 · 0 0

pray
PRAY
PRAAAAAAAAAY!!!

2006-08-03 19:08:52 · answer #4 · answered by Jeezuss Jan 3 · 0 0

fedest.com, questions and answers