vb程式設計選數

2022-11-05 22:16:54 字數 739 閱讀 8506

1樓:聽不清啊

首先要說明一下,按要求能得到的數不一定能有10個。如首個隨機數等於500,則後面的數一個也不能得到了。

private sub command1_click()dim a(10) as integer

n = 0

while n < 10 and a(n) < 500n = n + 1

while a(n) <= a(n - 1)a(n) = int(401 * rnd) + 100wend

wend

print "得到的數有"; n; "個,它們是:"

for i = 1 to n

print a(i);

next i

print

end sub

2樓:匿名使用者

private sub command1_click()dim n as integer, n1 as integerdim i as integer

clsdo while i < 10

doevents

randomize

n = int((500 - 100 + 1) * rnd + 100)

if n + 9 - i <= 500 and n > n1 then

n1 = n

i = i + 1

print n1, i

end if

loop

end sub

vb程式設計計算,VB程式設計計算 1 2

private sub command1 click dim i as integer,j as integerdim l as long,h as longfor i 1 to 10 h 1 for j 1 to i h h j next l l h next print l end sub pr...

vb程式設計教程答案,vb程式設計教程答案

option explicit private sub command1 click dim a as integer dim i,j,n redim a 9,9 for i 1 to 8 print tab 25 i 2 for j 1 to i a i,1 1 a i,i 1 a i 1,j 1...

VB程式設計計算s123,VB程式設計計算s

function ss tos as integer as integer tos參與復計算 制的最後一個數 dim i as integer ss 0 for i 1 to tos if i mod 2 0 then ss ss i else ss ss i end if next end fun...