文本框里。输入一个插入数据,插入到数组A中后,使数组仍然有序。
将程序空白处填写完整即可。
Dim a(1 To 11) AsInteger
Private SubCommand1_Click()
Dim i As Integer
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 90 + 10)
Next i
‘请在下面空白处将程序补充完整。
End Sub
Private SubCommand2_Click()
Dim d As Integer, m As Integer
Dim k As Integer, i As Integer
d = Val(Text3.Text)
‘请在下面空白处将程序补充完整。
For i = 1 To 11
Text2.Text = Text2.Text & Str(a(i))
Next i
EndSub
2.
随机产生10个100~200之间的正整数,把它们存放到数组中,求该数组中最大数、最小数及它们的平均数。
3.使用随机函数产生10个10~100之间的随机数存放在一维数组a中,并把该数组排序后显示在一个文本框里。删除其中一个数,并使数组仍然有序。
计算机VB中,利用随机函数产生10个10-100的随机数,并将其赋值给数组a...
Private Sub Command1_Click() Dim a(10) As Integer Randomize For i = 1 To 10 a(i) = Int(Rnd() * 91) + 10 Print a(i); s = s + a(i) Next i Print Print "平均值="; s \/ 10End Sub
vb单击“数列生成”按钮,自动生成10个10~90之间的随机整数,存于...
Dim a(1 To 10) As IntegerPrivate Sub Command1_Click() List1.Clear Randomize (Timer) For i = 1 To 10 a(i) = Int(Rnd(i) * 81 + 10) List1.AddItem a(i) Next iEnd SubPrivate Sub Command2_Click() List2.Clear For i = 1 To 9 For j = i + 1 ...
...随机函数产生并显示10 个1~100 之间的随机整数并找出这个数中的最...
Private Sub Command1_Click() Dim a(10) As Integer Randomize Max = 1 For i = 1 To 10 a(i) = 1 + Int(Rnd * 100) Print a(i); If a(i) > a(Max) Then Max = i Next i Print Print "a("; Max; ")="; a(Max)End Sub ...
...点击command1时,随机产生10个0到100的随机整数,并将其显示在text1...
Private Sub command1_click()Dim a(10) As Integer Dim temp As Long For i = 1 To 10 a(i) = Int(Rnd * 100 + 0.5)Next i Text1.Text = a(1) & Space(2) & a(2) & Space(2) & a(3) & Space(2) & a(4) & Space(2) & a(5) & Space(2) & a(6) & Sp...
用VB写代码产生10个100-200的随机数,保存在数组中,从小到大排序,输出...
Private Sub Form_Click() Dim a%(9), i%, j%, t% Randomize For i = 0 To UBound(a) a(i) = Int(Rnd * 101) + 100 Next For i = 0 To UBound(a) - 1 For j = 0 To UBound(a) - i - 1 If a(j) > a(j + 1) Then t = a(j):...
vb编程:随机产生10个1–100之间的整数,并按从小到大顺序输出,谁能帮我...
a(10), i, j As Integer For i = 0 To 9 a(i) = Int(Rnd * 100) + 1 Print a(i);Next For i = 0 To 8 For j = i To 9 If a(i) > a(j) Then t = a(i)a(i) = a(j)a(j) = t End If Next Next Print For i = 0 To 9 Print a(i)Next End Sub ...
vb 利用随机函数产生10个1~100之间的随机数,显示出最大值最小值,平均...
Private Sub Form_Click()Dim a(9) As Integer, max As Integer, min As Integer, arg As Single, i As IntegerRandomizeFor i = 0 To 9 a(i) = Int(Rnd * 100) + 1 arg = arg + a(i) If i = 0 Or a(i) > max Then max = a(i) If i = 0 Or a(i) ...
vb语句 设计一个随机数程序,生成10个范围是1到100随机整数,并求出这...
dim Max_num as int dim Sum_num as int dim Arr_num(9) as int '赋予初始值 Min_num=101 Max_num=-1 Sum_num=0 '循环10次获得10个随机数 for i=1 to 10 randomize Arr_num(i-1)=int(rnd*100)+1 '判断后赋值最小值 if Arr_num(i-1)<Min_num then Min_num=Arr_num(i-1...
关于VB:随机产生10个 递增的 100到400的随机数,存放到数组中,并显示结...
Private Sub Form_Click()Cls Randomize Dim a(0 To 9)Print "随机生成的10个数字为:"For i = 0 To 9 a(i) = Int(Rnd * 301 + 100)Print a(i) & " ";Next For i = 9 To 1 Step -1 For j = 0 To i - 1 If a(j) > a(j + 1) Then t = a(j)a(j) = a(j...
vb编写一个程序,利用随机函数Rnd生成10个10-99之间的整数,并计算其中素...
n= [ 10+int(90*rnd) ]st = [ st + " " + n ]forj=2 to [ n ][ n1=n1+1 ][ exit for ]text1.text=[ st ]text2.text= [ n-n1 ]