用VB编写程序完成以下功能:随机生成10个两位整数(必须使用数组),从中去掉一个最大数和一个最小数,然后求其平均数,并在窗体上输出。(vb学得不好,求帮忙解答,谢谢!)
楼主看看这个:
Private Sub Command1_Click()谢谢!
用VB编写程序完成以下功能:随机生成10个两位整数(必须使用数组),从中...
nMin As Long Dim vAvg As Double, i As Long Randomize nMax = 0: nMin = 100 '初始化设置 For i = 0 To 9 '产生10个数据 V = 10 + 89 * Rnd() '10到99 aNum(i) = V If (V > nMax) Then nMax = V If (V < nMin) Then nMin = V...
用VB编写程序,随机产生10个二位数,放入数组A中,从中选出一个最大的和...
Private Sub Command1_Click() Randomize Dim a(9) As Integer, intMax As Integer, intMin As Integer intMax = 0: intMin = 100 Print "Array:"; For i = 0 To 9 a(i) = Int(Rnd * 90 + 10) Print a(i); If a(i) > intMax Then intMax = a(i) ...
帮我解一下这道VB编程题:“随机产生10个两位整数,找出其中的最大值...
avg = avg \/10 print "最大值为" & max & ",最小值为" & min & ", 平均值为" & avg
vb随机输出10个两位整数,并求出最大值,最小值
Private Sub Form_Click()Randomize Print "原数列"For i = 0 To 9 a(i) = Int(Rnd * 11 + 10)Print a(i);Next Max = a(0): Min = a(0)For i = 1 To 9 If Max < a(i) Then Max = a(i)If Min > a(i) Then Min = a(i)Next Print Print "最大值:"; Max; "...
vb编程:随机产生10个两位随机奇数,求其中的最大值、最小值和平均值
Private Sub Form_Load()Dim a(10) As Single Dim i, j As Single For i = 0 To 9 '产生10个随机数 j = 0 Do Until j < 100 And j Mod 2 = 1 Randomize j = Int(Rnd * 100) + 10 Loop a(i) = j Next i Label1.Caption = "这10个数为:"For i = 0 To 9 Labe...
VB题,随机产生10个两位整数,求该数组中各元素的和、最大值、最小值
Dim str As String = "生成的数组为" & vbCrLf, sum As Integer = 0, i, j, temp As Integer Dim a(10) As Integer For i = 1 To 10 a(i) = Int(Rnd() * 90 + 10) str = str & a(i) & " " Next str = str & vbCrLf & "排序后的数组为" & vbC...
vb随机产生10个两位数,并找出最大数和最小数,显示出来
max = 0 min = 99 For i = 0 To 9 a(i) = Int(Rnd() * 89 + 10) ' 产生10-99的10个两位随机数 If a(i) >= max Then max = a(i) '比较求最大值 If a(i) <= min Then min = a(i) '比较求最小值 Print a(i); '输出产生的10个两位随机数 Next i Prin...
VB排序题。。:随即产生10个2位数,按从大到小递减的顺序排列,并显示排 ...
Print "排序前为:" '可删除 For i = 1 To 10 '开始随机生成10个数 a(i) = Int(Rnd * 89+10)Print a(i); ‘可删除 Next i Print ’可删除 '开始插入排序 For i = 2 To 10 If a(i) > a(i - 1) Then tmp = a(i)For j = i - 1 To 1 Step -1 If t...
随机产生10个两位数的素数,vb怎么做?
定义一个全局变量的数组:dim a(10) as integer 随机产生10个两位的素数,素数各不相同:Dim a(10), x As Integer Dim str As String = ""Dim di As Boolean = True Dim n As Integer Dim sd As For i = 1 To 10 Do Do Randomize()n = Int(Rnd() * 100 + 10)Loop Until Is...
VB随机产生10个2位整数并进行逆序输出
Form1.AutoRedraw = True Randomize For i = 0 To 9 a(i) = Int(Rnd * (99 - 10 + 1) + 10)Next For i = 0 To 9 s = s & a(i) & " "Next Print "生成的10个随机数为: " & s For i = 0 To 4 t = a(i): a(i) = a(9 - i): a(9 - i) = t Next...