VB找最大值

2022-12-23 18:25:45 字數 1243 閱讀 3837

1樓:匿名使用者

如果你只要找最大值的話,就不用排序了,只要:

dim a(1 to 20), t as integerprivate sub command1_click()text1.text = ""

text2.text = ""

for i = 1 to 20

randomize

a(i) = int(1 + 99 * rnd)text1.text = text1.text & a(i) & " "

next

end sub

private sub command2_click()t = a(1)

for i = 2 to 20

if t < a(i) then t = a(i)next i

text2.text = t

end sub

2樓:匿名使用者

dim a(1 to 20), t as integerprivate sub command1_click()text1.text = ""

text2.text = ""

for i = 1 to 20

randomize

a(i) = int(1 + 99 * rnd)if t < a(i) then t = a(i)text1.text = text1.text & a(i) & " "

next

end sub

private sub command2_click()text2.text = t

end sub

'這樣即可

3樓:

懸賞分:0 - 離問題結束還有 14 天 18 小時請問這裡**錯了???

dim a(1 to 20), t as integerprivate sub command1_click()text1.text = ""

text2.text = ""

for i = 1 to 20

randomize

a(i) = int(1 + 99 * rnd)text1.text = text1.text & a(i) & " "

next

end sub

private sub command2_click()for j = 1 to 20

if t < a(j) then t = a(j)next

text2.text = t

end sub

matlab求最大值,matlab 求最大值

a 1.8711 b 0.0111 c 0.9829 d 0.0087 t 0 10 100 x a.b exp a t 11 a log 100 a 4579 b a y c.d exp c t 11 c log 5 c 207 d c xm,xi max x figure,plot t,x ho...

二次函式最大值,二次函式最大值,最小值

y 1 1 2x 令y 0 x 2 y 2 1 4 2 2 4 4 1 2 10y 0 x 2 y單調增 y 0 x 2 y單調減 所以當x 2時 函式y才有最大值 10 汽車租賃公司的月收益y與每輛車的月租金x元間的關係為y x2 50 162x 21000 那麼每輛車月租金為多少元時,租賃公司的...

關於最大值的問題

sinx 2 1 cosx 2 所以y cosx 2 acosx 5 8a 1 20 x 2 所以0 cosx 1 配方y cosx a 2 2 a 2 4 5 8a 1 2二次函式開口向下,對稱軸cosx a 2 0 cosx 1 若a 2 0,a 0,則定義域在對稱軸右邊,是減函式所以cosx ...