zoukankan      html  css  js  c++  java
  • 数字转化罗马数字的函数

    Public Function mfH00R0_Get_RomanNumerals(intNum As Long) As String
       
        Dim intArabic(12) As Integer
        Dim strRoman(12) As String
        Dim intI As Integer
        Dim strOut As String

        intArabic(0) = 1000
        intArabic(1) = 900
        intArabic(2) = 500
        intArabic(3) = 400
        intArabic(4) = 100
        intArabic(5) = 90
        intArabic(6) = 50
        intArabic(7) = 40
        intArabic(8) = 10
        intArabic(9) = 9
        intArabic(10) = 5
        intArabic(11) = 4
        intArabic(12) = 1
        strRoman(0) = "M"
        strRoman(1) = "CM"
        strRoman(2) = "D"
        strRoman(3) = "CD"
        strRoman(4) = "C"
        strRoman(5) = "XC"
        strRoman(6) = "L"
        strRoman(7) = "XL"
        strRoman(8) = "X"
        strRoman(9) = "IX"
        strRoman(10) = "V"
        strRoman(11) = "IV"
        strRoman(12) = "I"

        intI = 0

        While intNum
            While intNum >= intArabic(intI)
                intNum = intNum - intArabic(intI)
                strOut = strOut & strRoman(intI)
            Wend
            intI = intI + 1
        Wend

        mfH00R0_Get_RomanNumerals = strOut

    End Function

  • 相关阅读:
    Piggy-Bank (hdoj1114)
    Word Amalgamation(hdoj1113)
    Lowest Bit(hdoj1196)
    1206: B.求和
    1207: C.LU的困惑
    STL初步
    关于521(nyoj)
    first blood暴力搜索,剪枝是关键
    变态最大值(nyoj)
    烧饼(nyoj779)
  • 原文地址:https://www.cnblogs.com/topboy168/p/460394.html
Copyright © 2011-2022 走看看