Possible Duplicate:
How do you find a roman numeral equivalent of an integer
I need to write a JSP function that will efficiently convert an integer (from 1 - 3000) to a ro开发者_高级运维man numeral.
Start simple. Work out how you would convert the numbers 1 - 9 into Roman. Code and test. When it is working correctly, extend it to handle numbers up to 99. Again code and test. When it is working correctly, extend it to handle numbers up to 999. Code, test and extend up to 3,000.
Google has quite a few links to both algorithms and code:
http://www.google.com/webhp?hl=&sourceid=navclient-ff&rlz=1B3GGLL_enUS384US384&ie=UTF-8#hl=en&sugexp=gsis%2Ci18n%3Dtrue&cp=34&gs_id=3&xhr=t&q=decimal+to+roman+numeral+algorithm&pf=p&sclient=psy-ab&rlz=1B3GGLL_enUS384US384&site=webhp&source=hp&pbx=1&oq=decimal+to+roman+numeral+algorithm&aq=0&aqi=g1&aql=&gs_sm=&gs_upl=&bav=on.2,or.r_gc.r_pw.&fp=d5bc1e92224c5138&biw=1003&bih=594
精彩评论