VB编程声明一个有10个元素的一维数组A使用Inputbox函数为所有元素赋值,将其最小元素的值及下标显示出来
VB编程声明一个有10个元素的一维数组A使用Inputbox函数为所有元素赋值,将其最小元素的值及下标显示出来...
VB编程声明一个有10个元素的一维数组A使用Inputbox函数为所有元素赋值,将其最小元素的值及下标显示出来
展开
1个回答
展开全部
Option Explicit
Private Sub Form_Load()
Form1.AutoRedraw = True
Dim A(10) As Single
Dim I As Byte
For I = 1 To 10
A(I) = Val(InputBox("输入第" & I & "个数", "输入", 88))
Print A(I);
Next
Print
A(0) = 1
For I = 2 To 10
If A(A(0)) > A(I) Then A(0) = I
Next
Print "最小的元素是第A("; A(0); ")"; "="; A(A(0))
End Sub
Private Sub Form_Load()
Form1.AutoRedraw = True
Dim A(10) As Single
Dim I As Byte
For I = 1 To 10
A(I) = Val(InputBox("输入第" & I & "个数", "输入", 88))
Print A(I);
Next
A(0) = 1
For I = 2 To 10
If A(A(0)) > A(I) Then A(0) = I
Next
Print "最小的元素是第A("; A(0); ")"; "="; A(A(0))
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询