mdsk.net
当前位置:首页 >> vB随机生成10个1 100数字 >>

vB随机生成10个1 100数字

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 ss(1 To 10) As Integer, I As Integer, J As IntegerPrivate Sub Command1_Click()For I = 0 To 2Text2(I).Text = ""Next IFor I = 1 To 9 For J = I + 1 To 10 If ss(I) < ss(J) Then TT = ss(I) ss(I) = ss(J) ss(J) = TT End If Next JNext IText2(0).Text = ss(1)

Private Sub Command1_Click() '生成10-100间10个数字求平均值及大于平均值的数字Me.ClsDim a() As Integer, i As Integer, he As IntegerDim pj As SingleProduceShu 10, 100, 10, a()Print "生成的10个数字分别为:" & Space(2);For i = 0 To

你好!for i=1 to 10 then t=t+1next i如果对你有帮助,望采纳.

'方法1,不是你的方法,呵呵,直接产生10个随机数记性排列,谁知道是怎么产生的 ,呵呵.randomizedim a(9)for i=0 to 9a(i)=int(rnd*300+101)next ifor 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 k

Randomize() For I=1 To 10 A(I)=Int(99*Rnd()+1) Next For I=1 To 10 For j=I+1 To 10 If A(I) temp=A(j) A(j)=A(I) A(I)=temp End if Next j Next I

dim a(10) as integer randomize for i=1 to 10 a(i)=int(100*rnd)+1 next i

Dim a(9) As Integer ' 定义10元素数组Private Sub Form_click() '窗体单击事件RandomizeDo ' 循环产生随机数a(i) = Int(100 * Rnd) + 1i = i + 1Loop Until i >= 10For i = 0 To 8 ' 冒泡排序 For j = 8 To i Step -1If a(j) < a(j + 1) Thent = a(j): a(j) = a(j + 1):

Option Base 1 Private Const n = 10 Private Sub Form_Click() Dim Sum As Long '存放总和变量 Dim a(n) As Long '定义一维数组存放随机数 Randomize '不让随机生成的值重复 Sum = 0 '初始化变量sum For i = 1 To n a(i) = CInt(Rnd * 100 + 1) '

Private Sub Command1_Click() Randomize For i = 1 To 10 Print Int(Rnd * 100) Next End Sub

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