非常感谢
vb随即产生两位正整数30个,显示在文本框1中,求出其中的素数,显示在文本...
For i = 1 To 30 '生成30个两位随机整数,并存放在Text1中 a(i) = Int(Rnd * 90 + 10)Text1.Text = Text1.Text & Str(a(i)) & Space(2)Next End Sub Private Sub Command2_Click() ' 判素数 For i = 1 To 30 m = 2 n = Int(Sqr(a(i)))'m在2~根号a(i)范围...
VB用随机数产生30个两位整数,在线等!回答出来在加分!!!
Private Sub Command1_Click()Dim s As String, i As Long For i = 1 To 30 Randomize Second(Now)s = s & "," & CStr(Int((100 * Rnd) + 1)) ' 生成 1 到 6 之间的随机数值。Next T...
1.随机产生30个两位正整数,将其中互不相同的数存入数组a中,按从小到...
Private Sub Form_Click()Dim a(30) As Integer, i As Integer, j As Integer Dim x As Integer, count As Integer, temp As Integer count = 0 For i = 1 To 30 x = Int((90 * Rnd) + 10): Randomize For j = 1 To count If a(j) = x Then Exit For Next j If j > ...
用VB编写函数求任意正整数的立方,并在窗体输出1至10的立方。
private sub command1_click()for i=1 to 10 print Cubic(i)next end sub
用vb编程随机产生十个数,然后输入其中一个数,找出该数在数组中的位置...
Private Type num xuhao As Integer i As IntegerEnd TypeDim a(10) As numDim temp As numPrivate Sub Command1_Click()For i = 1 To 10 a(i).i = InputBox("请输入第" & i & "个数字") a(i).xuhao = i Print a(i).iNext iFor i = 1 To 10 For j...
求一VB代码,用数组保存随机产生的10个介于20到50之间的整数,编程求出其...
Private Sub Command1_Click()Randomize Dim a(1 To 10)Dim max, min, ave min = 50: max = 20 For i = 1 To 10 a(i) = Int(Rnd * 21 + 30)Print a(i);If max < a(i) Then max = a(i)If min > a(i) Then min = a(i)ave = ave + a(i)Next i ave = ave \/...
用VB语言随机输入10个数,输出最大值和最小值,和其位置
min = a(i)End If If max < a(i) Then maxi = i max = a(i)End If Next For i = 1 To 10 temp = temp & a(i) & " "Next temp = "这十个数是:" & temp & "最大数" & max & "的位置在" & maxi & " " & "最小数" & min & "的位置在" & minj Msg...
用vb编程实现随机产生一个100到999之间的随机数,并将此数逆序输出
If i = k Then k = i + 1 'MsgBox "随机数:" & RndNumber Loop End Sub 3、无重复随机数算法二 这个算法比较巧妙,需要细细体会,才能知道真谛。这个算法不会重复产生随机数,但需要一个占位数组。比较适合输出范围之内所有数值的场合,比如,随机发牌。[vb] view plain copy print?' 产生20...
vb程序设计题 求代码 随机产生20个0~100的正整数(包括0和100),存放...
iPrint: PrintPrint "平均值为:" & AvePrint "最大值为:" & Mx & " 对应数组下标为:" & aPrint "最小值为:" & Mn & " 对应数组下标为:" & bEnd SubPrivate Function Max(List() As Integer) As Integer Dim i As Integer Max = List(LBound(List)) For i = L...
vb编程:随机产生10个1到20之间的整数,放在数组A中,然后将A的元素倒序...
Private Sub Command1_Click()Dim a(10) As Integer Randomize Print "原来的数:"For i = 1 To 10 a(i) = Int(Rnd * 20) + 1 Print a(i);Next i Print Print "交换以后的数:"i = 1: j = 10 Do While i < j t = a(i): a(i) = a(j): a(j) = t i = i + ...