欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

如何編寫一個小數(shù)轉(zhuǎn)換分數(shù)的函數(shù)?

 更新時間:2006年11月16日 00:00:00   作者:  

Public Function XtoF(str As Currency, Optional fenm As Integer = 32) As String

' 只限于整除分數(shù).
  Dim Cfm As Currency
  Dim cfmmod As Integer
  On Error GoTo Erroreof

  Cfm = 1 / fenm
  XtoF = ""
  If str = 0 Then XtoF = "": Exit Function

  Dim point As Integer
  Dim dInt As String
  Dim dPoint As Currency
  Dim fint, fint1, fint2 As Integer
  If str <> 0 Then
        If str > 1 Then
            point = InStr(1, str, ".", 1)
            If point = 0 Then
                XtoF = str:
                Exit Function
            Else
                dInt = Mid(str, 1, point - 1)
                dPoint = CCur("0." & Mid(str, point + 1))
                fint = InStr(1, XtoF(dPoint), "/", 1)
                fint1 = CInt(Mid(XtoF(dPoint), 1, fint - 1))
                fint2 = CInt(Mid(XtoF(dPoint), fint + 1))

                XtoF = CStr(dInt * fint2 + fint1) & "/" & CStr(fint2)

            End If
        Else
          If fenm Mod CInt(str / Cfm) = 0 Then
            XtoF = "1/" + CStr(fenm / CInt(str / Cfm))
          Else
              cfmmod = Maxgys(fenm, CInt(str / Cfm))
            XtoF = CStr(CInt(str / Cfm / cfmmod)) + "/" + CStr(CInt(fenm / cfmmod))
          End If
        End If
  Else
      XtoF = "0"
  End If
  Exit Function
Erroreof:
  XtoF = ""
End Function
Function Maxgys(num1 As Integer, num2 As Integer) As Integer
    Dim minnum, i As Integer
    minnum = num1
    If num1 > num2 Then minnum = num2
    For i = 1 To minnum
    If ((num1 Mod i) = 0) And ((num2 Mod i) = 0) Then Maxgys = i

    Next i
End Function

  • 如何編寫一個過濾掉HTML代碼的函數(shù)?

    如何編寫一個過濾掉HTML代碼的函數(shù)?

    如何編寫一個過濾掉HTML代碼的函數(shù)?...
    2006-11-11
  • 如何提示用戶打開Cookie?

    如何提示用戶打開Cookie?

    如何提示用戶打開Cookie?...
    2006-11-11
  • 如何制作K線圖?

    如何制作K線圖?

    如何制作K線圖?...
    2006-11-11
  • 如何對文件進行操作?

    如何對文件進行操作?

    如何對文件進行操作?...
    2006-11-11
  • 如何實現(xiàn)全文檢索?

    如何實現(xiàn)全文檢索?

    如何實現(xiàn)全文檢索?...
    2006-11-11
  • 如何把一長串數(shù)字分位顯示?

    如何把一長串數(shù)字分位顯示?

    如何把一長串數(shù)字分位顯示?...
    2006-11-11
  • 如何編寫高質(zhì)量的前端代碼(快手電商前端前端代碼規(guī)范)

    如何編寫高質(zhì)量的前端代碼(快手電商前端前端代碼規(guī)范)

    這篇文章主要介紹了如何編寫高質(zhì)量的前端代碼,這篇規(guī)范寫的不錯!需要的朋友可以參考下
    2024-02-02
  • 如何利用數(shù)據(jù)庫內(nèi)容建立一個下拉式列表?

    如何利用數(shù)據(jù)庫內(nèi)容建立一個下拉式列表?

    如何利用數(shù)據(jù)庫內(nèi)容建立一個下拉式列表?...
    2006-11-11
  • 如何用htmlEncode來顯示Unicode?

    如何用htmlEncode來顯示Unicode?

    如何用htmlEncode來顯示Unicode?...
    2006-11-11
  • 最新評論