1樓:匿名使用者
按照你的意思,相當於把陣列按正序和反序分別輸出。編寫程式如下:
dim a(1 to 20) as integer,i as integer
for i=1 to 20
a(i)=inputbox("請輸入第"+str(i)+"個數:")next i
for i=1 to 20
print a(i);
next i
for i=20 to 1 step -1print a(i);
next i
2樓:彳亍
dim a(1 to 20) as integer,i as integer
for i=1 to 20
a(i)=inputbox("請輸入第"+str(i)+"個數:")next i
for i=1 to 20
print a(i);
next i
for i=1 to 20
print a(i)=a(21-i);
next i
3樓:匿名使用者
private sub form_click()dim a(1 to 20)
for i = 1 to 20
a(i) = val(inputbox(""))next i
print "原來的陣列是:"
for i = 1 to 20
print a(i);
next i
for i = 0 to 9
t = a(i + 1): a(i + 1) = a(20 - i): a(20 - i) = t
next i
print "調換後的陣列是:"
for i = 1 to 20
print a(i);
next i
end sub
一道關於vb的題目,急求
4樓:匿名使用者
這個比較難哦。不是一串**就能解決的。
5樓:沒有童話的魚
已傳送到你郵箱。這是**。
有點問題,已經修改好了,已發你郵箱,有問題再找我。
private sub command1_click()fenshu = 0
for i = 1 to 10
label5.caption = i
jiashu1 = int((9 * rnd) + 1)jiashu2 = int((89 * rnd) + 10)label1.caption = str(jiashu1) & "+" & str(jiashu2) & "="
daan = inputbox("請輸入答案")if daan = cstr(jiashu1 + jiashu2) then
fenshu = fenshu + 10
else
daan2 = inputbox("答錯,請再次輸入答案")if daan2 = cstr(jiashu1 + jiashu2) then
fenshu = fenshu + 5
end if
end if
label2.caption = fenshunext
msgbox ("答題完畢")
end sub
求vb高手解答三道題目,急求!!!!!拜託各位大神!**等!!!!
6樓:゛愛她又如何
奇數:private sub command1_click()for i = 1 to 99 step 2print i
next i
end sub
fibonacci數列:
private sub command1_click()dim a as integer, b as integer, c as integer
a = 1: b = 1
print a; b;
for i = 3 to 20
c = a + b
print c;
a = b: b = c
next i
end sub
4*5矩陣:
option base 1
private sub command1_click()dim a(4, 5) as integerfor i = 1 to 4
for j = 1 to 5
a(i, j) = int(rnd * 100 + 1)print a(i, j);
next j
next i
min = 101
for i = 1 to 4
for j = 1 to 5
if a(i, j) < min then min = a(i, j)
next j
next i
for i = 1 to 4
for j = 1 to 5
if a(i, j) = min then print "最小值:"; a(i, j), "第"; i; "行"; "第"; j; "列"
next j
next i
end sub
7樓:匿名使用者
求奇數private sub comand1_click ()i=0do
i=i+1
if imod2 <>2 then
print i
end if
end sub
fibonacci數列
private sub command1_click ()dim f(1 to 20)
f(1)=1
f(2)=1
i=2do
i=i+1
f(i)=f(i-1)+f(i-2)
loop until i=20
i=0do
i=i+1
print f(i)
loop until i=20
end sub
矩陣dim a(1 to 4,1 to 5)i=0j=0
doi=i+1
doj=j+1
a(i,j)=int(100*rnd+1)loop until j=5
loop until i=4
不好意思啊,矩陣忘記怎麼整了,希望對您有所幫助
8樓:紅山人
急求!一道vb程式設計題 謝謝!
9樓:
private sub procmin(a() as integer, byval amin as integer)
dim i%, amin0%
for i = lbound(a) to ubound(a)print a(i);
amin0 = a(lbound(a))
if a(i) < amin0 then amin = a(i)next i
print "amin="; amin
end sub
private sub command1_click()dim a(1 to 10) as integer, i% ', amin0%
for i = 1 to 10
a(i) = int(501 * rnd + 300)next i
call procmin(a(), amin)end sub
10樓:匿名使用者
主程式dim a(10) as integerrandomize
for i = 0 to 9
a(i) = int((800 - 300 + 1) * rnd + 300)
next
procmin(a())
--子函式
function procmin(a() as integer) as integer
dim min as integer
min = a(0)
for i = 1 to 9
if min > a(i) then
min = a(i)
end if
next
procmin = min
end function
求解一道高中vb題目!
11樓:匿名使用者
private sub form_click()dim i as integer
dim s as integer
s = 1
for i = 1 to 9
s = (s + 1) * 2
next i
print "s="; s
end sub
是1534個 迴圈9次。因為第十天已經剩下1個 就沒再吃了 樓上那位 han4422951 - 都司 七級 初始值s為1 你還用除2 真服你了。~
12樓:匿名使用者
dim a%, s%, i%
a = 1 : s = 0
for i = 1 to 9
s = a * 2 + 2
a = s
next
print "s="; s
你拿筆自己演算一下就會知道,每一天的桃子數總是第二天的兩倍多兩個,第四行**就是根據每天的桃子數算出前一天的桃子數,然後再根據前一天的桃子數算出再前一天的桃子數,這個迴圈不能迴圈十次,因為迴圈了九次後已經是最初一天的桃子數了!最後的答案是1534
13樓:who絕版笨_我
這不是數學題嗎?
dim taozi as long
taozi=1
for i=1 to 10
taozi=taozi+1
taozi=taozi*2
next i
msgbox "桃子總數: " & trim(taozi)
14樓:匿名使用者
private sub form_clickdim n%,i%
x=1print"第10天的桃子數為:1個"
for i= 9 to 1 step-1
x=(x+1)*2
print"第";i;"天的桃子數為:";x;"個"
next i
end sub
求解一道VB題目,求解一道VB題目
答案是copyc.輸入10000個數值,計算平均數,適合採用迴圈結構演算法。a。判斷乙個證書是否為偶數,解決該問題僅需一步判斷,也許需要一步賦值,沒有多次重複的步驟,不適合採用迴圈結構演算法。b。輸入乙個圓的半徑,計算面積和周長。輸入資料 計算面積,這三個內容都是乙個語句就可以完成的,沒有多次重複的...
急求!一道VB程式設計題謝謝,10道VB題 急求答案!!!謝謝高手了
private sub procmin a as integer,byval amin as integer dim i amin0 for i lbound a to ubound a print a i amin0 a lbound a if a i amin0 then amin a i ne...
關於歷史的一道題目急關於歷史的一道題目急
秦國只是春秋 戰國時期的諸侯國之一 如 齊國 楚國等等 並非統一中國 與其他的諸侯國地位並列。秦朝是秦國統一中國後建立的國家後直至其滅亡期間時間的總稱也就是屬於秦國一統的朝代 是乙個時間段 秦國統一中國後 秦朝 在全國設立郡縣制 選a其他時代稱國家不稱朝代的還有很多 如三國 魏蜀吳 而司馬氏廢魏建立...