VB怎麼從1 8中取數,VB怎麼從1 8中取6個數

時間 2021-09-13 07:02:51

1樓:匿名使用者

private sub command1_click()for i1 = 1 to 8

for i2 = i1 + 1 to 8

for i3 = i2 + 1 to 8

for i4 = i3 + 1 to 8

for i5 = i4 + 1 to 8

for i6 = i5 + 1 to 8

s = i1 & i2 & i3 & i4 & i5 & i6if instr(ss, s) = 0 then ss = ss & vbcrlf & s

next

next

next

next

next

next

msgbox mid(ss, 3)

end sub

2樓:

dim a(1 to 6) as integer,i as integer,j as integer,f as boolean

randomize

for i=1 to 6

doa(i)=int(rnd*8)+1

f=false

if i>1 then

for j=1 to i-1

if a(i)=a(j) then f=true:exit fornext

end if

loop while f

next

3樓:匿名使用者

dim a(1 to 6) as integerfor i=1 to 6

a(i)=int((rnd*8)+1)

next i

這是在一到八取六個整數

vb從數中仰能滿足條件的數的所有組合

dim x 6 s private sub command1 click x 0 0 open answer.xls for output as 1getnum 1 選出第1個數 close 1 unload me end sub function getnum k 遞迴選出第k個數子程式for x...

VB中label顯示怎麼換行,在VB中怎麼怎麼設定label自動換行

有兩種方法實現label換行 1 將label控制元件的可以調整控制元件label的寬度和高度,即可實現自動換行 2 控制換行。例如 private sub form load with label1 caption 12 vbcrlf 345 vbcrlf 6789 end with end su...

VB怎麼宣告陣列,VB中陣列怎麼定義

如果有規律就可以用for next 來賦值,如果沒有規律,資料又很多的話,就從檔案裡面讀。dim 陣列名 as int new int vb中陣列怎麼定義 是這麼定義的 陣列中的第一個元素的下標稱為下界,最後一個元素的下標稱為上界,其餘的元素連續地分佈在上下界之間,且陣列在記憶體中也是用連續的區域來...