請那位高手幫我忙?用vb編寫人民幣大小寫轉換的程式,最好是把原始檔打包發上來

2021-04-10 11:05:52 字數 3128 閱讀 6476

1樓:匿名使用者

'窗體上有 text1,text2,command1 三個控制元件

option explicit

const strrmb_upcasenumeric = "零壹貳叄肆戚敬伍陸柒捌玖"

const strrmb_upcase1 = "元拾佰仟"

const strrmb_upcase2 = "元萬衝仔基億"

const strrmb_upcase3 = "角分釐"

function getrmb_upcase(pricexin)

dim str, curnumup, num1, num2, price, pricex, testflag, flagf, flag0, flag4, curnum, len1, len2, i

pricex = ccur(pricexin)

if pricex < 0 then

price = 0 - pricex

flagf = 1

else

price = pricex

flagf = 0

end if

'整數num1 = cstr(fix(price))

len1 = len(num1)

'小數num2 = mid(formatnumber((price - fix(price)), 3, vbtrue), 3)

len2 = len(num2)

str = ""

flag4 = 0

flag0 = 0

for i = 1 to len1

curnum = cint(mid(num1, i, 1))

curnumup = mid(strrmb_upcasenumeric, curnum + 1, 1)

if curnum = 0 then

flag4 = flag4 + 1

flag0 = 1

else

if flag0 = 1 then str = str & mid(strrmb_upcasenumeric, 1, 1)

str = str & curnumup

flag0 = 0

end if

testflag = (len1 - i) mod 4

if testflag = 0 then

'if flag4 < 4 or i = len1 then

'if str = "" and len1 = 1 then str = curnumup

if flag4 < 4 and i <> len1 then

str = str & mid(strrmb_upcase2, cint((len1 - i) /散謹 4) + 1, 1)

end if

flag4 = 0

flag0 = 0

else

if curnum = 0 then

else

str = str & mid(strrmb_upcase1, testflag + 1, 1)

end if

end if

next

if len(str) > 0 then str = str & "元"

flag0 = 0

for i = 1 to len2

curnum = cint(mid(num2, i, 1))

curnumup = mid(strrmb_upcasenumeric, curnum + 1, 1)

if curnum = 0 then

flag0 = 1

else

if flag0 = 1 then str = str & mid(strrmb_upcasenumeric, 1, 1)

str = str & curnumup

flag0 = 0

end if

if curnum = 0 then

else

str = str & mid(strrmb_upcase3, i, 1)

end if

next

if len(str) = 0 then str = str & "零元"

str = str & "整"

if flagf = 1 then str = "負" & str

getrmb_upcase = str

end function

private sub command1_click()

text2.text = getrmb_upcase(text1.text)

end sub

vb程式設計題:設計一個字元大小寫的轉換程式,

2樓:匿名使用者

字元來大小寫轉換程式,當文字框

源text1中輸

入大寫字母,在文字bai框text2中同時顯示其小du寫zhi字母dao;當文字框text1中輸入小寫字母,在文字框text2中同時顯示其大寫字母;當輸入其他字元,則原樣輸出。

建立兩個文字框

private sub form_load()text1.text = ""

text2.text = ""

end sub

private sub text1_keypress(keyascii as integer)

dim x as string * 1

x = chr$(keyascii)

select case x

case "a" to "z"

x = chr$(keyascii + 32)case "a" to "z"

x = chr$(keyascii - 32)case else

x = x

end select

text2.text = text2.text & xend sub

3樓:魔塔過客

ucase/lcase

提示這麼多,真正的程式設計師都是自己成長起來的

祝你學習愉快

4樓:地瓜

在命令按鈕的click事件中編寫:

thisform.text2.value=lcase(thisform.text1.value)

thisform.refleash

請各位高手幫我個忙,翻譯下面的中文

sales merchant department 賣場招商部assistant store deputy manager 店副經理 assistant store manager 店經理meeting conference room 會議內室office 辦公容室 店經理室 manager off...

請幫我解決VB作業,請幫我解決一個VB作業

private sub command1 click dim i as integer,s as integer,a 1 to 10 as integer,max as integer,min as integer max 30 min 100 for i 1 to 10 randomize a i...

請那位大師幫我算一下命,請那位大師幫我算下命

這沒關係的,我也經常這樣啊!過幾天,或給自己放個假,喝喝咖啡,聽聽歌啊之類的,就可以放輕鬆,自然就順了!請那位大師幫我算下命 男命 公元1984年3月25日4時30分出生 一九八四年 二月 二十三日 寅時 殺 印 日 殺 八字 甲 丁 戊 甲 子 卯 午 寅 性格 戊日生的人很守信義,重視節操,具有...