1樓:萍水e相逢
和bai 1 樓不一
du樣,
zhi我dao用到版
了權 text框
private sub ***mand1_click()dim a(1 to 25) as integerdim i as integer
text1.text = ""
for i = 1 to 25
randomize
a(i) = int(900 * rnd + 100)text1.text = text1.text + cstr(a(i))
if i mod 5 = 0 then
text1.text = text1.text + vbcrlfelse
text1.text = text1.text + vbtabend if
next i
end sub
2樓:
private sub ***mand4_click()dim a(24) as integer
call getrandomnumber(a)call printnumber(a)
end sub
private sub getrandomnumber(byref r() as integer)
randomize
dim i as integer
for i = 0 to 24
r(i) = int(900 * rnd()) + 100next i
end sub
private sub printnumber(byref r() as integer)
dim s as string
dim i as integer
dim j as integer
for i = 0 to 4
s = ""
for j = 0 to 4
s = s & vbtab & r(i * 5 + j)next j
debug.print s
next i
end sub
3樓:匿名使用者
private sub form_click()dim a(24), i, k as integerrandomize
for i = 0 to 24
a(i) = int(900 * rnd + 100)next i
for i = 1 to 25
print a(i - 1),
k = k + 1
if k mod 5 = 0 then print chr(13) & chr(10)
next i
end sub
vb 關於陣列的問題1.利用隨機函式生成一個4*5的矩陣(二維陣列),範圍是[1,100]之間的整數,求所有元
4樓:匿名使用者
dim a%(4, 5)
private sub ***mand1_click() '產生並bai輸出
for i = 1 to 4
for j = 1 to 5
a(i, j) = int(rnd * 100) '[1,100]print a(i, j);
next j
print '換行
next i
end sub
private sub ***mand2_click() '求最小du值
max = a(1, 1) '最大值zhi的初始值為dao第回一個答元素
for i = 1 to 4
for j = 1 to 5
if max < a(i, j) thenmax = a(i, j)
end if
next j
next i
print "最大值為:"; max
end sub
5樓:匿名使用者
function t_rand()
s = ""
dim a(0 to 4, 0 to 5) as integermax = 0
for i = 0 to 3
for j = 0 to 4
a(i, j) = int((100 * rnd) + 1)if a(i, j) > max then max = a(i, j)
s = s & a(i, j) & vbtab ' debug.print a(i, j)
next j
s = s & vbcrlf
'debug.print
next i
s = s & "max=" & max
form1.text1.text = s
end function
python中隨機生成10-99的整數,構成一個5×5的矩陣,顯示完整矩陣,並將矩陣轉置後顯示出來 5
6樓:好心bu分手
使用numpy 簡單的很
import numpy as np
import random
before = np.array([[random.randint(10, 99) for i in range(5)] for j in range(5)])
result = before.t
print(result)
7樓:匿名使用者
import numpy as np
matrix=random.randint(0,10,(5,5))print(matrix)
print(matrix.t)
急求vb程式設計「利用隨機函式產生50 100之間的隨機整
private sub command1 click randomize n rnd 10 for i 1 to n s s i a a 1 s 這裡應該注意!next msgbox n值為 str n 結果為 str a end sub 你沒給分啊 吃白飯,不行咧 計算機vb中,利用隨機函式產生1...
vb問題利用隨機函式產生10 99之間的隨機整數
我已經上機驗證過了,正確。思路 產生80個隨機數,把這80個隨機數由小到大排序,然後從第1個到第80個的順序挑選偶數,賦值給字串s1,夠10個換行 再從第80個到第1個的順序挑選奇數,賦值給字串s2,同上。有一點很重要 把這兩個文字框的mutltiline屬性要改為 true private sub...
利用隨機函式產生兩位整數,怎麼按從大到小的順序排序輸出
include include include using namespace std int main for int i 0 i 10 i for int j 0 j 9 i j if a j import random a range 10,100 b random.sample a,10 b...