mdsk.net
当前位置:首页 >> VB编程产生100个[10,99]的随机数 >>

VB编程产生100个[10,99]的随机数

'方法1,不是你的方法,呵呵,直接产生10个随机数记性排列,谁知道是怎么产生的 ,呵呵.randomize dim a(9) for i=0 to 9 a(i)=int(rnd*300+101) next i for j = 0 to 8 for k = 0 to 8 - j if a(k) > a(k + 1) then t = a(k) a(k) = a(k + 1) a(k + 1) = t end if next

下面是我给你写的程序,需要添加四个文本框,三个按钮,两个标签,其中文本框Text1和Text2的Multiline属性设置成true,ScrollBars属性可以设置成2或者不用设置.你要是对程序有什么疑问也可以留个QQ,我把工程和窗体文件发给你. '定义全

请采纳支持我,谢谢!Private Sub Command1_Click()Dim m, i As Long, j As Long, m1For i = 1 To 100 m = Int(100 * Rnd) If Right(m, 1) = 8 Then j = j + 1 If Len(m) = 1 Then m = m & Chr(32) If i = 1 Then m1 = m ElseIf i < 11 Then m1 = m1 & Chr(32)

Public Sub GetTJput() Dim a(1 To 100) As Integer Dim x(1 To 10) As Integer Dim i As Integer, p As Integer For i = 1 To 100 a(i) = Int(Rnd * 100) If a(i) 评论0 0 0

Dim a(10) As IntegerMin = 100: Max = 1For i = 1 To 10Randomizea(i) = Int(Rnd(1) * 100 + 1)Label1.Caption = Label1.Caption & Str(a(i))Sum = Sum + a(i)If a(i) > Max Then Max = a(i)If a(i) 评论0 0 0

dim Num(100) as integer dim TJ(10) as integer dim temp as integer for i=1 to 100 num(i-1)=int(99*rnd()) temp=val(right(str(num(i-1)),1)) TJ(temp)=tj(temp)+1 next i for i=0 to 99 form1.print num(i-1) next i for i=0 to 9 form1.print "各位数字为" & i & "的数字共有:" & tj(i) & "个";next i

Private Sub Form_Click()RandomizeFor i = 10 To 99n = Int(Rnd * i + 10)NextPrint nEnd Sub

Private Sub command1_click()Dim a() As IntegerRandomizen = -1Don = n + 1ReDim Preserve a(n)a(n) = Int(Rnd * 90) + 10Print a(n);If (n + 1) Mod 10 = 0 Then PrintIf n &gt; 0 Thenf = Falseb = a(n) \ 10 + (a(n) Mod 10) * 10For i = 0 To n - 1If b = a(i)

Private Sub Command1_Click()Dim m(9) As IntegerDim a As IntegerDim i As IntegerDim j As Integera = 0For i = 0 To 9 m(i) = 10 + Int(Rnd * 89)NextText1.Text = m(0) & "," & m(1) & "," & m(2) & "," & m(3) & "," & m(4) & "," & m(5) &

Dim a(10) As Integer, sum As Integer sum = 0 For i = 1 To 10 Randomize a(i) = Int(Rnd * 100) Next i For i = 1 To 10 If a(i) Mod 3 0 Then sum = sum + a(i) End If Next i 求采纳

网站首页 | 网站地图
All rights reserved Powered by www.mdsk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com