1樓:匿名使用者
private sub command1_click()on error resume next
dim a(5) as integer
randomize
'int((upperbound - lowerbound + 1) * rnd + lowerbound)
for i = 0 to 3
b = ""
c = 0
for j = 1 to 5
a(j) = int((100 - 10 + 1) * rnd + 10)
b = b & " " & a(j)
next
c = a(1)
if c < a(2) then c = a(2)if c < a(3) then c = a(3)if c < a(4) then c = a(4)if c < a(5) then c = a(5)print b & " 最大數為:" & cnext
end sub
2樓:匿名使用者
option explicit
private sub command1_click()randomize timer
dim i as byte, max as byte, min as byte, irnd as byte
min = 255
for i = 1 to 20
irnd = 10 + int(rnd * 91)if irnd > max then max = irndif irnd < min then min = irndprint format(irnd, "@@@ ");
if i mod 5 = 0 then printnext
print "max num:"; max; " min num:"; min
end sub
3樓:excel開發
private sub form_click()dim i, j, a(20) as integerrandomize
a(0) = int(rnd() * 91 + 10)j = a(0)
print a(0); " ";
for i = 1 to 19
a(i) = int(rnd() * 91 + 10)if i mod 5 = 0 then printprint a(i); " ";
if j < a(i) then j = a(i)next i
print "最大值="; j
end sub
4樓:匿名使用者
private sub command1_click()dim a(21) as integer, s as stringdim i as integer, m as integerrandomize
for i = 1 to 20
a(i) = int(90 * rnd + 10)s = s & " " & a(i)
if i mod 5 = 0 then
s = s & chr(13)
end if
next i
m = a(1)
for i = 2 to 20
if m < a(i) then m = a(i)next i
print "隨機數為:" & chr(13) & sprint "最大數:" & m
end sub
vb程式設計:產生20個10至100間的隨機整數存入一維陣列a中,每行5個元素輸出;定義一個4行5列的二維陣列
5樓:匿名使用者
private sub command1_click()dim a(20) as integer, b(4, 5) as integer
randomize
for i = 1 to 20
a(i) = int(rnd * 91) + 10print a(i);
if i mod 5 = 0 then printnext
for i = 1 to 4
for j = 1 to 5
b(i, j) = a(j + (i - 1) * 5)print b(i, j);
next
next
end sub
6樓:匿名使用者
private sub form_load()dim a(1 to 20) as integerdim b(1 to 4, 1 to 5) as integerdim j, i as integer
j = 1
for i = 1 to 20
randomize
a(i) = int(rnd() * 90) + 10next i
for i = 1 to 20
k = i mod 5
if k = 0 then k = 5
b(j, k) = a(i)
if i mod 5 = 0 then j = j + 1next i
print "a:"
for i = 1 to 20
print a(i),
if i mod 5 = 0 then print chr(13)next i
print "b:"
for i = 1 to 4
for j = 1 to 5
print b(i, j),
next j
next i
end sub
原創喲,臭美一下
7樓:匿名使用者
dim i as long,a(1 to 20) as longfor i=1 to 20
a(i)=cint(int((100- 10+ 1) * rnd() + 10))
next i
vb產生30個0~1000的隨機整數,放入一個陣列中,輸出最大值
8樓:兄弟連教育北京總校
'實現**如下
private sub form_click()me.cls
dim n(1 to 30) as integerdim i%,nmax%
dim str as string
'產生30個0-1000的隨機數並寫入陣列randomize
for i = 1 to 30
n(i) = int((1000 - 0 + 1) * rnd + 0)
str = str & n(i) & " "
if i mod 10=0 then str=str & vbcrlf
next i
'找最大值
nmax=n(1)
for i = 1 to 30
if n(i)>nmax then nmax=n(i)next i
print str '窗體顯示隨機數
print "最大值:" & nmax
end sub
vb編寫程式,隨機產生20個10到100間的整數 輸出這些數 並求這批數的最大值及其位置
9樓:聽不清啊
private sub command1_click()dim a(20) as integer
randomize
max = 0: j = 0
for i = 1 to 20
a(i) = int(91 * rnd) + 10print a(i);
if max < a(i) then max = a(i): j = i
next i
print "最大值="; max, "出現在第版權"; j; "個"
end sub
如何VB設計程式,到指定使用次數或指定日期後無法使用該程式
要是說到指定日期打不開 你可以使用day date 來獲得指定日期,用month date 來獲得月份 用 year date 來獲得年份 比如你想在它2011年6月19日打不開 可以這樣寫 option explicit private sub form load if year date 201...
VB 10以內加法程式,用VB設計一個簡單的加法,和求和的小程式怎麼弄
private sub form load dim i,s as integer for i 1 to 10 s s i next i print s end sub dim i as integer dim sum as integer for i 1 to 10 sum sum i next p...
用vb60設計程式,在窗體上的標籤label中
private sub form load label1.caption 歡迎進入vb的程式設計世界 label1.font 文泉驛等寬正黑 不要意思咱機子上沒有 楷體 label1.fontsize 14.25label1.fontbold truelabel1.backcolor vbreden...