国产超薄丝袜足底脚交国产_少妇愉情理伦片丰满丰满_一区二区三区中文人妻制服_久久久久88色偷偷免费_色婷婷久久久swag精品

萬(wàn)能百科  > 所屬分類  > 

閱讀以下說(shuō)明和Visual Basic代碼,填入(n)處。 [說(shuō)明] 在一些財(cái)務(wù)軟件中,經(jīng)常需要將阿拉伯?dāng)?shù)字的賬

閱讀以下說(shuō)明和Visual Basic代碼,填入(n)處。

[說(shuō)明]

在一些財(cái)務(wù)軟件中,經(jīng)常需要將阿拉伯?dāng)?shù)字的賬目轉(zhuǎn)化為漢語(yǔ)習(xí)慣中的金額計(jì)數(shù)方法,例如:

“3.45”轉(zhuǎn)化為“叁元四角五分”;

“3.4”轉(zhuǎn)化為“叁元四角”;

“3.40”轉(zhuǎn)化為“叁元四角零分”;

“3.456”轉(zhuǎn)化為“叁元四角五分”;

“345.00”轉(zhuǎn)化為“叁百四十五元零角零分”;

“345”轉(zhuǎn)化為“叁百四十五元”;

以下Visual Basic代碼實(shí)現(xiàn)了小寫(xiě)金額轉(zhuǎn)換為大寫(xiě)金額。界面如圖10-9所示。結(jié)合實(shí)際例子說(shuō)明,仔細(xì)閱讀下面代碼,將(n)代碼補(bǔ)充完整。

[代碼7-1]

Begin VB.FormForm1

Caption = "小寫(xiě)金額轉(zhuǎn)換為大寫(xiě)金額"

//...窗體描述(略)

Begin VB.CommandButton Command1

Caption = "退出"

//...窗體描述(略)

End

Begin VB.TextBox Text2

//...窗體描述(略)

End

Begin VB.TextBox Text1

Enabled = 0 "False

//…窗體描述(略)

End

Begin VB.Labe1 Labe12

Caption = "轉(zhuǎn)換為大寫(xiě)金額"

//...窗體描述(略)

End

Begin VB.Labe1 Labe11

Caphon = "請(qǐng)輸入數(shù)字"

//...窗體描述(略)

End

End

[代碼7-2]

Private Function setdata (num As Integer) As String "數(shù)字轉(zhuǎn)換

Select CaSe num

Case 0

setdata="零"

Case 1

Setdata="壹"

Case 2

Setdata="貳"

Case 3

Setdata="叁"

Case4

Setdata="肆"

Case 5

Setdata="伍"

Case 6

Setdata="陸"

Case 7

Setdata="柒"

Case 8

Setdata="捌"

Case 9

Setdata="玖"

End Select

End Function

Private Function chang (aaa As Integer) As String "位數(shù)轉(zhuǎn)換

Select CaSe aaa

Case 1

chang=""

Case 2

chang="十"

Case 3

chang="百"

Case 4

chang="千"

Case 5

chang="萬(wàn)"

Case 6

chang="十"

Case 7

chang="百"

Case 8

chang="千"

Case 9

chang="億"

Case 10

chang="十"

End Select

End Function

[代碼7-3]

Private Sub Text2_Change ( ) "小寫(xiě)轉(zhuǎn)大寫(xiě)

Dim i As Integer

Dim j As Integer

Dim myint As Integer

Dim myint1 As Integer

Dim mydoub As Double

Dim mystr As String

Dim mystr1 As String

Dim mystr2 As String

Dim mystr3 As String

Dim mystr4 As String

Dim money As Long

Dim money1 As Integer

Dim money2 As Long

mystr=Text2.Text

myint=InStr (mystr, ".")

If myint=0 Then

mystr=Text2.Text

Else

mystr3=Right(Text2.Text, Len (Text2.Text ) - myint)

If mystr3<>""Then "轉(zhuǎn)換小數(shù)位

mystr4=Left(mystr3, 1)

mystr3=Right(mystr3, Len(mystr3 )

正確答案:

(1)mystr2=mystr2+setdata(Val(mystr4))+"角"(2)mystr2=mystr2+setdata(Val(mystr4))+"分"(3)If Right(mystr11) >"萬(wàn)"Then mystr1=mystr1&"萬(wàn)"(4)I fRight(mystr11) >"零"And Right(moneyj) >0 Then mystr1=mystr1&"零"(5)mystr1=mystr1 & setdata(money1)

詞條內(nèi)容僅供參考,如果您需要解決具體問(wèn)題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。

標(biāo)簽