blsn.net
当前位置:首页 >> 一维数组中,输出最大值和最小值,VB编程,求各位... >>

一维数组中,输出最大值和最小值,VB编程,求各位...

Private Sub Command1_Click() Dim a(14) As Integer maxi = 0 For i = 0 To 14 a(i) = Int(Rnd * 100) If a(maxi) < a(i) Then maxi = i Print a(i); Next i Print t = a(0): a(0) = a(maxi): a(maxi) = t Print "对换以后:" For i = 0 To 14...

下面的代码能正确执行,已经调试通过: Sub xxx() Dim Sstr, Arr, Vmin, Vmax, i Sstr = InputBox("输入一些数字,用空格分开") Arr = Split(Trim(Sstr), " ") For i = LBound(Arr) To UBound(Arr) If Trim(Arr(i)) "" Then Arr(i) = Val(Arr(i)...

1、遍历数组进行比较查找即可。 2、vb6示例代码: Option Explicit Private Sub Command1_Click() Randomize Timer Dim a(9) As Integer, i As Integer Dim x, Fp As Integer, Zp As Integer For i = 0 To 9 '模拟生成一个随机数组 a(i) = 50 - ...

Private Sub Command1_Click() Dim a(10) As Integer Dim max As Integer Dim min As Integer Dim avg As Double Dim sum As Integer sum = 0 Randomize For i = 1 To 10 If i = 1 Then a(i) = Int(Rnd * 90 + 10) max = a(i) min = a(i) sum = ...

for i=1 to 5 a(i)=i+1 next

dim A(1 to 10) as integer,i as integer,n as integer,max as integer randomize for i=1 to 10 a(i)=int(rnd()*100) '给数组赋值 next i max=a(1) n=1 for i=1 to 10 if a(i)>max then max=a(i) n=i end if next i print "最大值:";max;"下标...

Private Sub Form_Click() Dim N as Integer,A() as Integer Dim Max as integer,Min as integer,Avg as Integer N=10 Redim A(1 to n) as Integer Randomize Max=0 Min=100 For i=1 to N A(i)=Int(Rnd*90)+10 if A(i)>Max Then Max=a(i) If A(i)

题目不是交代了要用循环,但是你没用啊,没用循环是做不了这件事的。 Dim x(1 To 10) As Integer, max As Integer, min As Integer,i As Integer Label1.Caption = "" For i = 1 To 10 x(i) = Val(InputBox("输入第“ & i & "个整数", "输入整数"...

Dim a(1 To 10) As IntegerPrivate Sub Command1_Click() Randomize For i = 1 To 10 a(i) = Int(Rnd * 101) Print a(i); Next i PrintEnd SubPrivate Sub Command2_Click() Dim max As Integer, min As Integer max = 0 min = 100 For i = 1 To...

Private Sub Command1_Click() Cls Dim a(1 To 10) As Integer Dim xb As Integer, min As Integer For i = 1 To UBound(a) a(i) = Val(InputBox("请你输入第" & i & "个数", , "1")) Print a(i); Next i Print xb = 1: min = a(1) For i = 2 To...

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