VB程序 从键盘上输入10个数存放于数组a,再输入x的值,位序
发布网友
发布时间:2024-07-21 18:38
我来回答
共1个回答
热心网友
时间:2024-08-02 11:57
'添加一个按钮Command1
Private Sub Command1_Click()
Dim a(9) As Integer, n As Integer
For i = 0 To 9
a(i) = InputBox("输入第" & i + 1 & "个数")
Print a(i);
Next
Print
n = InputBox("输入一个数n")
For i = 0 To 9
If a(i) = n Then
MsgBox "第" & i + 1 & "个数与n相同"
Exit For
ElseIf i = 9 And a(i) <> n Then
MsgBox "数组中没有与n相同的数"
End If
Next
End Sub