vb随机生成10个数并显示在一个文本框中, 并找出最大数,指出它的位置
添加一个text1,输入以下代码,然后运行。单击窗体,十个随机数显示在text1中,弹出对话框,提示第几个为最大数,并将最大数选中。Private Sub form_Click()Dim a(1 To 10) As Integer, i As Integer Randomize For i = 1 To 10 a(i) = Int(Rnd * 90) + 10 Text1.Text = Text1.Te...
用VB语言随机输入10个数,输出最大值和最小值,和其位置
For i = 1 To 10 temp = temp & a(i) & " "Next temp = "这十个数是:" & temp & "最大数" & max & "的位置在" & maxi & " " & "最小数" & min & "的位置在" & minj MsgBox temp End Sub
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的for循环编写产生10个100~200直接的数,求最大值
使用VB语言编写的程序,实现产生10个100~200的随机数,并求它们的最大值:```Dim num(9) As Integer '定义数组存储随机数Dim maxNum As Integer '定义变量存储最大值Randomize '初始化随机数种子For i = 0 To 9 '循环产生10个随机数num(i) = Int((200 - 100 + 1) * Rnd + 100) '...
VB里实现从随机生成的10个100以内的数中找出最大值并显示在文本框Textbo...
As Integer, Max As Integer, i As Integer For i = 1 To 10 x(i) = Int(Rnd * 100) Print x(i); Next i Print Max = x(1) For i = 2 To 10 If x(i) > Max Then Max = x(i) End If Next i Text1.Text = "最大值为" & MaxEnd Sub ...
怎么用vb设计 随机产生10个100到200之间的数,求出最大值与最小值
1、首先需要启动VB6.0,新建一个标准exe工程。2、打开VB6.0之后,在窗体上绘制一个命令按钮。3、接下来需要双击命令按钮进入代码窗口。4、接下来开始编辑按钮的单击事件。5、最后就可以按F5运行测试。求出最大值与最小值。
vb语句 设计一个随机数程序,生成10个范围是1到100随机整数,并求出这...
dim Min_num as int 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 ...
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个小于100的数 并求出其中最大的值
Cls '清屏 Randomize '初始化随机数生成器。Dim a(1 To 10)For x = 1 To 10 '产生10个循环 a(x) = Int(100 * Rnd()) '产生小于100的随机整数 Next Dim i, j, t As Integer For i = 1 To 10 For j = i + 1 To 10 If a(i) > a(j) Then '将较大的数推到最后 t ...
vb编写程序,利用随机函数产生并显示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 ...