vb题目,应用Inputbox函数输入10个整数至数组,以正序输入,逆序打印,每...
发布网友
发布时间:2023-12-24 19:56
我来回答
共1个回答
热心网友
时间:2024-11-01 14:10
Private Sub Command1_Click()
Dim inNum(10) As Long
Dim i As Long
For i = 1 To 10
Dim tmp As String
tmp = ""
While tmp = "" '确保输入的数据是正确的
tmp = InputBox("请输入第" & i & "个整数:", "提示")
If Val(tmp) = 0 And tmp = "" Then
tmp = ""
End If
Wend
inNum(i) = tmp '得到正确的输入
Next
'逆序输出
Dim k As Long
For i = 10 To 1 Step -1
k = k + 1
Print vbTab & inNum(i);
If k = 5 Then
'五个换行
Print
k = 0
End If
Next
End Sub