VB用exit do語句,產生隨機的兩位數,當偶數的個數為6的時候結束

時間 2021-08-11 17:10:57

1樓:匿名使用者

private sub form_click()static i as integer

static j as integer

static k as integer

k = 0

j = 0

me.cls

randomize

dok = k + 1

i = (rnd() * 90 + 10) mod 100me.print i;

if i mod 2 = 0 then

j = j + 1

me.print "*"

else

me.print

end if

if j = 6 then exit dodoevents

loop while 1

me.print "共產生了" & k & "個隨機數"

end sub

2樓:匿名使用者

option explicit

sub test()

dim i as integer, tem as integerdotem = int(rnd * 100)if tem mod 2 <> 0 then tem = tem + 1

i = i + 1

if i > 6 then exit doprint tem

loop

end sub

3樓:匿名使用者

那就用exit do做啊,for,while,do。。。while,看一下這幾個迴圈用法就知道了

SQL語句隨機更新,SQL語句隨機產生隨機數

看樣子,資料庫像sqlserver的,如果是單條update的話,用這個 update s calculateprepaidmoney set count count ceiling rand 9 其中 select ceiling rand 9 就是1 9的隨機數 sql server中如何實現隨...

用vb編寫利用隨機函式產生10 99之間(包括10和

dim n m,a 19 max max 0 for n 0 to 19 a n int rnd 90 10 生成20個10 99的隨機數 next n for n 0 to 18 for m n 1 to 19 if a n a m then swap a n a m 排序從小到大end if n...

vb程式設計 利用隨機函式產生10 99之間的隨機整數

option explicit private sub command1 click dim a 80 as integer,b as integer,nb as integer dim i as integer,j as integer,t as integer 隨機生成80個隨機數 text1....