1樓:岔路程式緣
第一題'建立一個text1,
dim r as single
dim s(8) as integer
private sub form_load()
form1.autoredraw = true
text1.text = 578.62
form1.width = 11000
text1.top = 1000
end sub
private sub text1_keypress(keyascii as integer)
select case keyascii
case 46, 48 to 57
case 13
if text1.text = "" then exit sub
r = format(val(text1.text), "0.00")
call zh(r)
print "一百元", "五十元", "十元", "五元", "一元", "五角", "一角", "五分", "一分"
for i = 0 to 8
print s(i),
next
case else
keyascii = ""
end select
end sub
function zh(byval i as single)
i = i * 100
s(0) = i \ 10000
i = i mod 10000
s(1) = i \ 5000
i = i mod 5000
s(2) = i \ 1000
i = i mod 1000
s(3) = i \ 500
i = i mod 500
s(4) = i \ 100
i = i mod 100
s(5) = i \ 50
i = i mod 50
s(6) = i \ 10
i = i mod 10
s(7) = i \ 5
s(8) = i mod 5
end function
第三題'建立七個command1-7
option explicit
dim str as string
dim s() as single, s1() as single, min as single, max as single
dim n as integer, i as integer, k as integer
dim shu as boolean
private sub command1_click()
clsstr = inputbox("陣列元素個數", "輸入", 10)
if str = "" then exit sub
if val(str) < 1 then exit sub
n = int(val(str)) - 1
redim s(n)
call sjsz
for i = 0 to n
print s(i);
if i mod 10 = 9 then print
next
command3.enabled = true
command4.enabled = true
command5.enabled = true
command6.enabled = true
end sub
private sub command2_click()
clsstr = inputbox("陣列元素個數", "輸入", 10)
if str = "" then exit sub
if val(str) < 1 then exit sub
n = int(val(str)) - 1
redim s(n)
for i = 0 to n
s(i) = srsz(i + 1)
print s(i);
if i mod 10 = 9 then print
next
command3.enabled = true
command4.enabled = true
command5.enabled = true
command6.enabled = true
end sub
private sub command3_click()
redim s1(n)
for i = 0 to n
s1(i) = s(i)
next
n = n + 1
redim s(n)
for i = 0 to n - 1
s(i) = s1(i)
next
s(n) = srsz(n + 1)
for i = 0 to n
print s(i);
if i mod 10 = 9 then print
next
end sub
private sub command4_click() '3)在陣列中第k個元素前插入一個元素;
str = inputbox("在第幾個元素前插入?(" & 1 & "-" & n + 1 & ")", "輸入", n)
if str = "" then exit sub
k = int(val(str))
if k < 1 or k > n + 1 then exit sub
redim s1(n)
for i = 0 to n
s1(i) = s(i)
next
n = n + 1
redim s(n)
s(k - 1) = srsz(k)
for i = 0 to n
if i < k - 1 then
s(i) = s1(i)
elseif i > k - 1 then
s(i) = s1(i - 1)
end if
next
for i = 0 to n
print s(i);
if i mod 10 = 9 then print
next
end sub
private sub command5_click() '4)刪除陣列中的第k個元素;
str = inputbox("刪除第幾個元素?(" & 1 & "-" & n + 1 & ")", "輸入", n)
if str = "" then exit sub
k = int(val(str))
if k < 1 or k > n + 1 then exit sub
redim s1(n)
for i = 0 to n
s1(i) = s(i)
next
n = n - 1
redim s(n)
for i = 0 to n
if i < k - 1 then
s(i) = s1(i)
elseif i >= k - 1 then
s(i) = s1(i + 1)
end if
next
for i = 0 to n
print s(i);
if i mod 10 = 9 then print
next
end sub
private sub command6_click()
str = inputbox("刪除哪個元素?", "輸入", n)
if str = "" then exit sub
min = val(str)
domax = cxys(min)
if max <> n + 2 then
msgbox "刪除第" & max + 1 & "個元素"
redim s1(n)
for i = 0 to n
s1(i) = s(i)
next
n = n - 1
redim s(n)
for i = 0 to n
if i < max then
s(i) = s1(i)
elseif i >= k then
s(i) = s1(i + 1)
end if
next
for i = 0 to n
print s(i);
if i mod 10 = 9 then print
next
end if
loop while max <> n + 2
end sub
private sub command7_click()
endend sub
private sub form_load()
form1.autoredraw = true
form1.width = 8000
form1.height = 6000
command1.caption = "產生隨機陣列"
command2.caption = "輸入陣列"
command3.caption = "後面新增"
command4.caption = "中間新增"
command5.caption = "按位置刪除"
command6.caption = "按值刪除"
command7.caption = "退出"
command3.enabled = false
command4.enabled = false
command5.enabled = false
command6.enabled = false
end sub
function srsz(byval l as integer) as single
dostr = inputbox("第" & l & "個元素", "輸入", l)
if str = "" then
shu = false
else
shu = true
srsz = val(str)
end if
loop while not shu
end function
private sub sjsz()
str = inputbox("陣列元素最小值數", "輸入", -100)
if str = "" then exit sub
min = int(val(str))
str = inputbox("陣列元素最大值數", "輸入", 100)
if str = "" then exit sub
max = int(val(str))
if max < min then exit sub
randomize
for i = 0 to n
s(i) = int(rnd * (max - min)) + min
next
end sub
function cxys(byval l as single) as integer '檢索要刪除的元素
for i = 0 to n
if s(i) = l then
cxys = i
exit for
else
cxys = n + 2
end if
next
end function
都執行過。
高分懸賞,急如何兌換美元,高分懸賞!!!緊急求助!!
為什麼這麼多人都不懂裝懂啊!你們引用的都是2002年的法律條文了!幾個月前已經允許個人購匯了!不需要什麼旅遊簽證,也不需要這樣那樣的證明!只要身份證就行!喂!上面的這些老兄怎麼那麼不負責任?現在的外幣買賣已經放開了,各個國際通用幣種,如美圓 歐元 港幣等,只要帶身份證,其它什麼都不用帶,去各個銀行都...
英文翻譯 高手來吧,高分懸賞哦
四。特性為奧因斯顯著性 顯著性的定義是區別d軸和q軸電感。為了控制與寬恆功率區永磁同步電動機,它的設計應具有較高顯著性。隨著管結構的各種型號建議 alyz年級到顯著性的特點奧因斯。此外,磁鐵的位置在模型改變了增加q軸電感。圖。分析表明四種模式倒拉奧因斯特色顯著性。在極弧極間距為73.5 比美國東部時...
高分懸賞解夢高手求高手解夢,高分懸賞
夢見空中的飛機突然墜毀 做 夢人不在飛機上 會有偏財運出現,生意會更加興旺,財源廣進。你是一個關心國家大事的人,平時喜歡看國內 國際新聞 其次,可能你最近由於某種原因精神比較緊張,這個夢提醒你要注意調節情緒,然而夢境顯示你一定會有驚無險的,所以你務必要放寬心 再次,看看自己的身體有無不適的地方,要及...