編寫vb程式 要求隨機產生整數成績

2022-03-11 15:39:03 字數 1205 閱讀 1772

1樓:匿名使用者

dim marr%(1 to 10)

private sub command1_click()dim i%

text1.text = ""

for i = 1 to 10

randomize

marr(i) = int(rnd * 41) + 60text1.text = text1.text & marr(i) & " "

next

end sub

private sub command2_click()dim max%, min%, sum%

min = 100

for i = 1 to 10

if marr(i) > max then max = marr(i)

if marr(i) < min then min = marr(i)

sum = sum + marr(i)

next i

text2.text = max

text3.text = min

text4.text = sum / 10end sub

2樓:甜咖啡很甜

private sub command1_click()dim radnumber(1 to 10) as integerrandomize

for i = 1 to 10

radnumber(i) = rnd * 40 + 60next

max = radnumber(1)

for i = 2 to 10

if radnumber(i) > max thenmax = radnumber(i)

end if

next

min = radnumber(1)

for i = 2 to 10

if radnumber(i) < min thenmin = radnumber(i)

end if

next

for i = 1 to 10

rdnnumber.text = rdnnumber.text & " " & radnumber(i)

sum = sum + radnumber(i)next

arver.text = sum / 10max.text = max

min.text = min

end sub

已經除錯過

VB程序編寫,VB程式編寫

新增兩個控制元件,一個按鈕,一個label1控制元件陣列,label1 0 label1 1 private sub form load pi 3.14159265358979end sub private sub text1 change label1 0 caption sin text1.te...

用VB編寫程式,用VB編寫一個程式

樓上的,不許要引用吧 option explicit private declare function getdrivetype lib kernel32 alias getdrivetypea byval ndrive as string as long private declare funct...

在vb中利用隨機函式產生,在 VB中,利用隨機函式產生 10個 1 100 之間的隨機整數,找出其中能被 5 整除的數並求其和

private sub command1 click text1.text dim aa 1 to 20 as integer,ss as integer,sda as integer for i 1 to 20 randomize aa i int rnd 99 1 next i for i 1 ...